问题
I have followed this link in order to install pyglet in mac, because it is the only resource I have found that solves the "wrong architecture" problem. However, when I execute the last commmand pip install pyobjc==2.2
, it gives me the following error:
AttributeError: 'module' object has no attribute '_install_lib'
----------------------------------------
Cleaning up...
Command /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -c "import setuptools, tokenize;__file__='/private/var/folders/Gb/Gbm1htNCGKeECJJNr2vUpk+++TQ/-Tmp-/pip_build_nueye/pyobjc-core/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/Gb/Gbm1htNCGKeECJJNr2vUpk+++TQ/-Tmp-/pip-6kYwdv-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/var/folders/Gb/Gbm1htNCGKeECJJNr2vUpk+++TQ/-Tmp-/pip_build_nueye/pyobjc-core
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/bin/pip", line 11, in <module>
sys.exit(main())
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/__init__.py", line 185, in main
return command.main(cmd_args)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/basecommand.py", line 161, in main
text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 68: ordinal not in range(128)
I have tried to execute the helloworld example from the pyglet programing guide anyway, but when I execute pyglet.app.run()
, the pyglet window freezes and does not display anything.
Do you have any idea why this is happening? Is there another way to install pyglet in mac?
回答1:
I don't understand the point of your pyobjc install ?
The issue with Pyglet on osX is 64-bit architecture, so just try this to force python to go 32bit by typing this in your console:
defaults write com.apple.versioner.python Prefer-32-Bit -bool yes
回答2:
I installed pyglet this way. after downloading pyglet, and after i opened Terminal on my mac (with my name displayed ending with $) I typed
cd /usr/local/bin
then I typed ls
(list command) which showed me I had pip3
and pip3.6
as well as python3.6
(and other files)
so then I typed in this
python3.6 -m pip install pyglet
and pyglet installed and showed Collecting pyglet
Downloading pyglet-1.2.4-py3-none-any.whl (964kB)
100% |████████████████████████████████| 972kB 1.2MB/s
Installing collected packages: pyglet
Successfully installed pyglet-1.2.4
来源:https://stackoverflow.com/questions/24311119/installing-pyglet-in-mac