简体   繁体   English

在Mac上安装Pygame时出现问题

[英]Trouble installing Pygame on a Mac

I've installed Python 2.7 and Pygame on my Mac, but every time I try to 'import pygame', I get this error message: 我已经在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

What am I doing wrong? 我究竟做错了什么?

This is a typical architecture issue. 这是一个典型的体系结构问题。 Try a 尝试一个

file /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so

If one of the result lines includes your architecture (eg i386), then the problem is not from the package itself, but from the way you launched it. 如果结果行之一包含您的体系结构(例如i386),则问题不在于软件包本身,而在于您启动它的方式。 Try then to launch it from a 32 bits instance of Python: 然后尝试从32位Python实例启动它:

python2.7-32
>>>import pygame

NB: you can guess your architecture with 注意:您可以通过以下方式猜测您的架构

uname -m

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM