首页 > 解决方案 > 尝试使用 python3 导入 pyautogui 时出错

问题描述

```在此处输入代码So I installedpyautogui` 但我在导入它时遇到了问题:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyautogui/_pyautogui_osx.py", line 5, in <module>
    import Quartz
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/Quartz/__init__.py", line 5, in <module>
    import objc
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/objc/__init__.py", line 32, in <module>
    from objc._bridgesupport import *
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/objc/_bridgesupport.py", line 13, in <module>
    import pkg_resources
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 36, 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 "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyautogui/__init__.py", line 110, in <module>
    from . import _pyautogui_osx as platformModule
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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

好的,我尝试安装pyobjc-corepyobjc但我又遇到了同样的问题,我也不明白为什么有对电子邮件包的引用```

body
{
background-color:gray;
}

标签: python

解决方案


推荐阅读