ModuleNotFoundError:没有名为“ Quartz”的模块

时间:2018-06-20 12:20:25

标签: python python-3.x

我正在尝试使用python3并使用mac。我已经安装了pyobjc-core和pyobjc,但是错误指出Quartz未找到。我对这种安装非常陌生。有什么解决办法吗?

这是我的pycharm错误:

Traceback (most recent call last):
  File "/Users/Thyme/PycharmProjects/DinosourBot/venv/lib/python3.6/site-packages/pyautogui/_pyautogui_osx.py", line 5, in <module>
    import Quartz
ModuleNotFoundError: No module named 'Quartz'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/Thyme/PycharmProjects/DinosourBot/Bot.py", line 2, in <module>
    import pyautogui
  File "/Users/Thyme/PycharmProjects/DinosourBot/venv/lib/python3.6/site-packages/pyautogui/__init__.py", line 110, in <module>
    from . import _pyautogui_osx as platformModule
  File "/Users/Thyme/PycharmProjects/DinosourBot/venv/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

Process finished with exit code 1

3 个答案:

答案 0 :(得分:2)

我已经解决了这个问题 安装pyobic-framework-quartz, 由pycharm提供

答案 1 :(得分:1)

万一有人在这里绊倒,请使用:

pip install pyobjc-framework-Quartz

答案 2 :(得分:0)

我建议最好安装所有pyObjC,而不仅仅是特定的框架。始终,如果您正在使用Quartz,那么至少将需要各种CoreFoundation对象和常量。更不用说AppKit或其他框架了,这取决于您在做什么。

pip install pyobjc(或pip3)应安装所有内容,并允许您import Quartz。 (它对我来说适用于多个python!)