成功安装pyautogui,pyobjc-core和pyobjc后,从终端运行.py程序时pyautogui不起作用

时间:2018-08-03 11:35:26

标签: python pyobjc pyautogui

当我在Idle中运行命令时,Pyautogui似乎确实可以工作。

我收到此错误消息

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 20, in <module>
    import http.client as http_client
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 71, in <module>
    import email.parser
ModuleNotFoundError: No module named 'email.parser'; 'email' is not a package

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyautogui/_pyautogui_osx.py", line 5, in <module>
    import Quartz
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/Quartz/__init__.py", line 5, in <module>
    import objc
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/objc/__init__.py", line 32, in <module>
    from objc._bridgesupport import *
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/objc/_bridgesupport.py", line 13, in <module>
    import pkg_resources
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pkg_resources/__init__.py", line 36, in <module>
    import email.parser
  File "/Users/Booth/pyscript/email.py", line 2, in <module>
    from selenium import webdriver
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/__init__.py", line 18, in <module>
    from .firefox.webdriver import WebDriver as Firefox  # noqa
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 22, in <module>
    import httplib as http_client
ModuleNotFoundError: No module named 'httplib'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./messagerob.py", line 3, in <module>
    import pyautogui
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyautogui/__init__.py", line 110, in <module>
    from . import _pyautogui_osx as platformModule
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyautogui/_pyautogui_osx.py", line 7, in <module>
    assert False, "You must first install pyobjc-core and pyobjc: https://pyautogui.readthedocs.io/en/latest/install.html"
AssertionError: You must first install pyobjc-core and pyobjc: https://pyautogui.readthedocs.io/en/latest/install.html

我已经卸载并重新安装了几次模块,直到尝试使用pyautogui时再也没有收到任何错误消息。

运行macOS 10.13.6,python 3.6.5

0 个答案:

没有答案