简体   繁体   中英

Issue with Installing PyObjC for Python

I was attempting to install PyObjC on my Mac OS X El Capitan, and about 40 minutes into the download, I received an error and it stopped. I tried installing using the following code in my terminal:

pip install pyobjc

The error says:

Command python setup.py egg_info failed with error code 1 in
/private/var/folders/6x/pl46qrrj2n51fs9z00cw46240000gn/T/pip_build_Dustin/pyobjc-framework
-AVKit
 Storing debug log for failure in /Users/Dustin/Library/Logs/pip.log

I am using Xcode Version 7.3 and have been searching online for some answers but have been unable to find anything that seems to help. Any suggestions as to how to get the download to complete?

You are using Python 2.7, but from the logs, it appears as though you're trying to install pyobjc for a different version, most probably Python 3.

Line 267: pkg_resources.VersionConflict: (pyobjc-core 2.5.1 (/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC), Requirement.parse('pyobjc-core>=3.1.1'))

If you wish to use Python 3, use this method to install:

python3 -m pip install pyobj

Alternatively, I suggest you go ahead and download pyobjc from here , and install it manually from the source using this command:

  • For Python 2.7: python2.7 pyobjc/install.py
  • For Python 3.x: python3 pyobjc/install.py

The documentations here and here , clearly explain the installation process in further details. The latter deals with some possible problems, too.

Another alternative is to try easy_install :

python -m easy_install pyobjc

Note

Please ensure that you have commandline-tools from xcode installed before attempting to install pyobjc . Also, make sure that you run this in your terminal beforehand if you use Mac OS X 10.8 or lower.

 xcode-select --install.

Finally, it might be a good idea to install the core separately:

python2.7 -m pip install -U pyobjc-core
python2.7 -m pip install -U pyobjc

Lets try these and see if they work!

Hey please make sure to check that you have installed these dependencies:

image==1.5.27
numpy==1.17.4
Pillow==6.2.1
requests==2.22.0
opencv-python
olefile==0.46
PyAutoGUI==0.9.48
PyMsgBox==1.0.7
pyobjc-core==6.2
pyobjc-framework-Cocoa==6.1
pyobjc-framework-Quartz==5.3
PyScreeze==0.1.26
PyScreeze==0.1.26
PyTweening==1.0.3
pathlib

Add these to your requirements.txt file and install with pip install -r requirements.txt

That should solve the problem. Also make sure that you are using python versions 3.6 and above

This error recurred in the Python 3 context.

As of the Big Sur update on October 12, 2021, after trying a lot of other solutions, this fixed it for me:

pip install pyobjc-core==8.0b1
pip install pyobjc-framework-Cocoa==8.0b1
pip install pyobjc-framework-Quartz==8.0b1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM