“通用包装器中没有匹配的架构”导入pygame时

发布于 2024-12-10 00:25:22 字数 832 浏览 1 评论 0原文

我使用的是运行 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情未る 2024-12-17 00:25:22

删除旧的 pygame 安装并重新安装对我来说很有效。
我运行的是 Mac OS 10.7

sudo rm -Rf /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame

然后从以下位置复制并安装 pygame:

http://www.pygame.org/ftp /pygame-1.9.2pre-py2.7-macosx10.7.mpkg.zip

Removing the old pygame install and reinstalling did the trick for me.
I'm running Mac OS 10.7

sudo rm -Rf /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame

Then copy and install pygame from:

http://www.pygame.org/ftp/pygame-1.9.2pre-py2.7-macosx10.7.mpkg.zip

大姐,你呐 2024-12-17 00:25:22

虽然 Sylvain 上面说的是正确的,但这个错误通常是由于 python 和 pygame 之间的比特率差异引起的。重新下载它可能只会有帮助,因为您当时获得了正确的发行版。要了解 python 的比特率,请执行以下操作:

import platform
platform.architecture()

如果是 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:

import platform
platform.architecture()

If it is 32 bit, get a 32 bit distribution of pygame. Otherwise, get a 64 bit distribution.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文