无法在Mac OSX上安装Pygame
这是我的错误消息:
Python 2.7.2 (default, Jun 20 2012, 16:23:33)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named pygame
>>>
因此2.7找不到pygame.这是在新安装的python上,而且我可以进入其他模块(pyo,wx,numpy).我已经重新安装了pygame并在相应的库文件夹中查看,但在任何地方都找不到pygame模块.重新安装不能解决此问题.有什么建议吗?
So 2.7 can't find pygame. This is on a new installation of python, and I'm able to get to my other modules (pyo,wx,numpy). I have reinstalled pygame and looked among the respective library folders and I can't find the pygame module anywhere. A reinstallation does not fix this. Any Advice?
为回答有关如何安装pygame的问题,我从位于 http://www的.dmg安装. pygame.org/download.shtml 'pygame-1.9.1release-python.org-32bit-py2.7-macosx10.3.dmg'
In response to questions as to how I installed pygame, I installed from the .dmg located here http://www.pygame.org/download.shtml 'pygame-1.9.1release-python.org-32bit-py2.7-macosx10.3.dmg '
如果您使用的是32位处理器或64位处理器,则说明会有所不同.使用32位处理器的用户应在
The instructions differ if you have a 32-bit proccessor or a 64-bit one. Users of 32-bit processors should just download and install the binary labeled pygame-1.9.1release-python.org-32bit-py2.7-macosx10.3.dmg on the pygame download page. Users of 64-bit processors should follow the instructions below.
-
在Mac OS X中没有pygame的64位版本.pygame的32位版本仅与python的32位版本兼容. 但是,有一个警告/警告要注意:在Snow Leopard上,Apple提供的Tcl/Tk(支持IDLE的GUI库)版本可能已过时并引起问题. Snow Leopard用户应首先从此处下载并安装更新版本,在Mac OS X(通用)下标记为ActiveTcl 8.4.19.5. . 应该首先安装它. Lion用户应忽略此步骤.
There is no 64-bit version of pygame for Mac OS X. The 32-bit version of pygame is only compatible with a 32-bit version of python. However, there is a warning/caution to be aware of: on Snow Leopard the Apple-provided version of Tcl/Tk (a GUI library which powers IDLE) can be out-of-date and cause problems. Snow Leopard users should first download and install an updated version from here, labeled ActiveTcl 8.4.19.5 under Mac OS X (Universal). This should be installed first. Lion users should ignore this step.
删除(如果已安装)Python 2.7文件夹(最有可能在/Applications中).这很可能是不应使用的Python的64位版本.
Delete, if already installed, the Python 2.7 folder (most likely in /Applications). This is most likely the 64-bit version of Python that should not be used.
在Python 2.7.2 Mac OS X下此处下载并安装32位版本的Python 2.7.2. 32位i386/PPC安装程序. 无论下载页面说什么,该版本在Mac OS X Lion上都是兼容的.如果您使用正确的版本,则安装大小(如安装程序中所示)应为90 MB左右.
Download and install the 32-bit version of Python 2.7.2 provided here under Python 2.7.2 Mac OS X 32-bit i386/PPC Installer. Regardless of what download page says, this version is compatible on Mac OS X Lion. If you have the correct version, the install size (as displayed in Installer) should be around 90 MB.
在此处下载并安装pygame的32位版本.
Download and install the 32-bit version of pygame, located here.
您可以通过打开IDLE并输入以下命令来测试是否有效: 导入pygame
You can test to see if this has worked by opening IDLE, and typing: import pygame
如果没有输出,则可以正常工作.相反,如果收到通用包装器中没有匹配的体系结构"错误,则很可能跳过了步骤2.
If there is no output, it worked. If instead you get a "no matching architecture in universal wrapper" error, then most likely step 2 was skipped.