我在Mac上安装了Python 2.7和Pygame,但每次尝试'导入pygame'时,都会收到以下错误消息:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import pygame
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
我做错了什么?
答案 0 :(得分:0)
这是一个典型的架构问题。试试
file /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so
如果其中一个结果行包含您的体系结构(例如i386),那么问题不在于程序包本身,而在于您启动它的方式。然后尝试从32位Python实例启动它:
python2.7-32
>>>import pygame
注意:您可以使用
猜测您的架构uname -m