我尝试安装 autogui python 扩展:
pip3 install pyautogui
并且此安装尝试会导致以下错误消息:
Collecting pyautogui
Using cached PyAutoGUI-0.9.33.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/00/zcr6mkx90hg7kr4x_ks6nhhw0000gn/T/pip-build-edy15oyn/pyautogui/setup.py", line 6, in <module>
version=__import__('pyautogui').__version__,
File "/private/var/folders/00/zcr6mkx90hg7kr4x_ks6nhhw0000gn/T/pip-build-edy15oyn/pyautogui/pyautogui/__init__.py", line 110, in <module>
from . import _pyautogui_osx as platformModule
File "/private/var/folders/00/zcr6mkx90hg7kr4x_ks6nhhw0000gn/T/pip-build-edy15oyn/pyautogui/pyautogui/_pyautogui_osx.py", line 4, in <module>
import Quartz
File "/usr/local/lib/python3.5/site-packages/Quartz/__init__.py", line 5, in <module>
import objc
File "/usr/local/lib/python3.5/site-packages/objc/__init__.py", line 18, in <module>
_update()
File "/usr/local/lib/python3.5/site-packages/objc/__init__.py", line 15, in _update
import objc._objc as _objc
ImportError: dlopen(/usr/local/lib/python3.5/site-packages/objc/_objc.cpython-35m-darwin.so, 2): Symbol not found: _PyObject_REPR
Referenced from: /usr/local/lib/python3.5/site-packages/objc/_objc.cpython-35m-darwin.so
Expected in: flat namespace
in /usr/local/lib/python3.5/site-packages/objc/_objc.cpython-35m-darwin.so
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/00/zcr6mkx90hg7kr4x_ks6nhhw0000gn/T/pip-build-edy15oyn/pyautogui
我的 Mac OS 版本是 OS X El Capitan 10.11.3,我的 Python3 版本是 3.5.1,我的 pip3 版本是 pip 8.0.2。
Stackoverflow 上似乎有一个类似的问题(Cannot install pip install pyautogui, error code 1),但修复不适用于我的问题;我已经安装了“枕头”。另外,我已经阅读了文档(https://pypi.python.org/pypi/PyAutoGUI),并安装了 pyobjc-core 和 pyobjc。安装工具已安装并且是最新的。
有谁知道如何解决这个错误(并安装 pyautogui)?我认为错误可能源于Python 3.5.1 中缺少 _PyObject_REPR。