“通用包装器中没有匹配的架构”导入pygame时
我使用的是运行 Snow Leopard 10.6.8 和 Python 2.7.2 的 MacBook Pro。我访问了 pygame 网站,下载并安装了所有必需的框架和程序,编译并安装了 pygame,但我无法将模块导入到 python 中。我从 pygame 网站下载了一个示例程序,每次运行它时都会收到此错误:
Traceback (most recent call last):
File "/Users/jesse/Downloads/PurpleMines/PurpleMines.py", line 3, in <module>
from pygame import *
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
我猜它的问题与运行 64 位操作系统有关?
预先感谢您的帮助。
I'm on a MacBook Pro running Snow Leopard 10.6.8 and Python 2.7.2. I went on the pygame website, downloaded and installed all the required frameworks and programs, compiled and installed pygame, but I cant import the module into python. I downloaded an example program off of the pygame website and every time I run it I get this error:
Traceback (most recent call last):
File "/Users/jesse/Downloads/PurpleMines/PurpleMines.py", line 3, in <module>
from pygame import *
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
I'm guessing its a problem having to do with running a 64-bit OS?
Thanks in advance for the help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
删除旧的 pygame 安装并重新安装对我来说很有效。
我运行的是 Mac OS 10.7
然后从以下位置复制并安装 pygame:
Removing the old pygame install and reinstalling did the trick for me.
I'm running Mac OS 10.7
Then copy and install pygame from:
虽然 Sylvain 上面说的是正确的,但这个错误通常是由于 python 和 pygame 之间的比特率差异引起的。重新下载它可能只会有帮助,因为您当时获得了正确的发行版。要了解 python 的比特率,请执行以下操作:
如果是 32 位,则获取 pygame 的 32 位发行版。否则,获取 64 位发行版。
While what Sylvain said above is correct, this error is often caused by differences in bit rate between python and pygame. It is possible that redownloading it only helps because you get the correct distribution that time. To tell the bit rate of python, do this:
If it is 32 bit, get a 32 bit distribution of pygame. Otherwise, get a 64 bit distribution.