2014-06-19 36 views
0

爲了在mac中安裝pyglet,我遵循this link,因爲它是我發現的解決「錯誤的體系結構」問題的唯一資源。然而,當我執行最後一條命令pip install pyobjc==2.2,它給了我下面的錯誤:在mac中安裝Pyglet

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) 

我試圖執行the helloworld example from the pyglet programing guide反正,但是當我執行pyglet.app.run(),該pyglet窗口凍結,不能顯示任何內容。

你知道爲什麼會發生這種情況嗎?有沒有另一種方式來安裝pyglet在mac?

回答

1

我不明白你的pyobjc安裝點?

在OSX與Pyglet的問題是64位架構,所以只是嘗試這種強制蟒蛇通過在控制檯輸入此去32位:

defaults write com.apple.versioner.python Prefer-32-Bit -bool yes 
+0

我正在安裝pyobjc,因爲pyglet安裝被解釋的鏈接是這樣說的。 我會嘗試儘快使用32位python。謝謝您的回答! –

+0

您的建議有效,謝謝! –

1

我安裝pyglet這種方式。 下載pyglet,之後我在我的Mac打開終端(我的名字顯示爲$結尾) 我輸入

cd /usr/local/bin 

後,然後我打這表明我ls(list命令)我有pip3pip3.6以及python3.6(和其他文件) 所以後來我在這個

python3.6 -m pip install pyglet 

類型和pyglet安裝並顯示 收集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