gpt4 book ai didi

python - 为 Mac OS X 10.6.8 安装 Pygame

转载 作者:太空狗 更新时间:2023-10-29 17:01:23 26 4
gpt4 key购买 nike

使用 Python 2.7.2。当我尝试导入 pygame 时,我收到此错误消息:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/__init__.py", line 95, in <module>
from pygame.base import *
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so, 2): no suitable image found. Did find:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so: no matching architecture in universal wrapper

我不太清楚这是什么意思。我应该自己编译 pygame 吗?

最佳答案

Python 2.7.3 .dmg Mac OS 安装程序将 64 位和 32 位二进制文​​件安装在:

/Library/Frameworks/Python.framework/Versions/2.7/bin/

该文件夹中有一个名为 python2.7-32 的 32 位二进制文​​件。

要在终端中使用它,只需键入 $ python2.7-32 而不是 python

要在 IDLE 中使用它,只需将 64 位 python2.7 二进制文件重命名为 python2.7-64,然后重命名 python2.7-32 ' 到 python2.7`,下次启动 IDLE 或终端时,它将使用 32 位二进制文​​件。完成后将其改回。

您还可以从终端以 32 位模式强制启动 IDLE:

$ arch -i386/Library/Frameworks/Python.framework/Versions/2.7/bin/idle2.7 -n

您可以创建一个 shell 脚本 Automator 应用程序以使其更易于启动。

关于python - 为 Mac OS X 10.6.8 安装 Pygame,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8275808/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com