【问题标题】:Installing Pyglet in mac在 mac 中安装 Pyglet
【发布时间】:2014-08-10 06:11:55
【问题描述】:

我已关注this link,以便在 mac 中安装 pyglet,因为它是我发现的唯一解决“错误架构”问题的资源。但是,当我执行最后一个命令pip install pyobjc==2.2 时,它给了我以下错误:

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窗口冻结并且不显示任何内容。

你知道为什么会这样吗?有没有其他方法可以在 mac 中安装 pyglet?

【问题讨论】:

    标签: python macos python-2.7 pyglet pyobjc


    【解决方案1】:

    我不明白您安装 pyobjc 的意义何在?

    在 osX 上 Pyglet 的问题是 64 位架构,所以只需在控制台中输入以下命令来尝试强制 python 进入 32 位:

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

    【讨论】:

    • 我正在安装 pyobjc,因为解释 pyglet 安装的链接是这样说的。我会尽快尝试使用 32 位 python。谢谢你的回答!
    【解决方案2】:

    我以这种方式安装了 pyglet。 下载 pyglet 后,在我的 Mac 上打开终端后(我的名字以 $ 结尾) 我输入了

    cd /usr/local/bin
    

    然后我输入了ls(列表命令),这表明我有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
    

    【讨论】:

      猜你喜欢
      • 2012-05-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-01
      • 2021-07-25
      相关资源
      最近更新 更多