编程语言
首页 > 编程语言> > python – pip3安装pyautogui失败,错误代码为1 Mac OS

python – pip3安装pyautogui失败,错误代码为1 Mac OS

作者:互联网

我尝试安装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. Setuptools已安装并且是最新的.

有没有人知道如何解决这个错误(并安装pyautogui)?我认为错误可能源于此,因为_PyObject_REPR is missing in Python 3.5.1.

解决方法:

我找到了a workaround.“Kentzo”的代码为我解决了这个问题:

pip3 install https://github.com/GreatFruitOmsk/pyobjc-core/releases/download/v3.0.5.dev0/pyobjc-core-3.0.5.tar.gz

由于代码不是由我编写的,请使用此变通方法,风险自负.

标签:python-3-5,pyautogui,python,python-3-x,macos
来源: https://codeday.me/bug/20190829/1760520.html