[英]pip3 install pyautogui fails with error code 1 Mac OS
I tried installing the autogui python extension: 我尝试安装autogui python扩展:
pip3 install pyautogui
And this installation attempt results in the following error message: 此安装尝试导致以下错误消息:
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
My Mac OS version is OS X El Capitan 10.11.3, my Python3 version is 3.5.1, and my pip3 version is pip 8.0.2. 我的Mac OS版本是OS X El Capitan 10.11.3,我的Python3版本是3.5.1,而我的pip3版本是pip 8.0.2。
There seems to be a similar question on Stackoverflow ( Cannot install pip install pyautogui, error code 1 ), but the fix does not apply to my problem; Stackoverflow上似乎有类似的问题( 无法安装pip install pyautogui,错误代码1 ),但修复程序不适用于我的问题; I have already installed "pillow".
我已经安装了“枕头”。 Also, I have read the documentation ( https://pypi.python.org/pypi/PyAutoGUI ), and installed pyobjc-core as well as pyobjc.
另外,我已阅读文档( https://pypi.python.org/pypi/PyAutoGUI ),并安装了pyobjc-core以及pyobjc。 Setuptools are installed and up-to-date.
Setuptools已安装并且是最新的。
Does anyone have an idea how to fix this error (and install pyautogui)? 有没有人知道如何解决这个错误(并安装pyautogui)? I think the error might originate, because _PyObject_REPR is missing in Python 3.5.1 .
我认为错误可能源自,因为Python 3.5.1中缺少_PyObject_REPR 。
I found a workaround . 我找到了一个解决方法 。 This code by "Kentzo" fixed the issue for me:
“Kentzo”的这段代码为我解决了这个问题:
pip3 install https://github.com/GreatFruitOmsk/pyobjc-core/releases/download/v3.0.5.dev0/pyobjc-core-3.0.5.tar.gz
Since the code is not written by me, please use this workaround at your own risk. 由于代码不是由我编写的,请使用此变通方法,风险自负。
SOLVED 解决了
Run: 跑:
1. sudo pip3 install pil
2. sudo pip3 install Pillow
3. sudo pip3 install pyautogui
Bingo! 答对了! installed without an error
安装没有错误
If you are like me and had no success installing pyautogui, here is what I did to fix the issue: 如果你像我一样并没有成功安装pyautogui,我就是这样做来解决这个问题:
sudo pip3 install pyobjc-core
sudo pip3 install pyobjc
sudo pip3 install Pillow
sudo pip3 install pyautogui
Steps 2, 3, and 5 are detailed here . 这里详细介绍了步骤2,3和5。
Step 4 is described here , another Stackoverflow post. 这里描述了第4步,另一个Stackoverflow帖子。
The sequence of steps which worked for me on macOS High Sierra(10.13.4) : 在macOS High Sierra(10.13.4)上为我工作的一系列步骤:
Install Xcode from AppStore 从AppStore安装Xcode
activate virtual environment (if needed) 激活虚拟环境(如果需要)
pip3 install pyobjc-core pip3安装pyobjc-core
pip3 install pyobjc-framework-Quartz pip3安装pyobjc-framework-Quartz
pip3 install image pip3安装映像
pip3 install pyautogui pip3安装pyautogui
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.