python 在 leopard 上安装
我承认我完全被 python 安装搞糊涂了。 有人可以帮助我如何安装
我想玩 PyGame、PyOpenGL 等的模块。所以我安装了它们,但每次我输入“import pygame”时都会显示错误消息。
到目前为止,这是我的环境。
在 .bash_profile 中,
PATH=${PATH}:/System/Library/Frameworks/Python.framework/Versions/Current/bin
使用 easy_install PyOpenGL 放置了此
/Library/Python/2.5/site-packages/PyOpenGL-3.0.0b8-py2.5.egg
Locating pygame 模块
dchong:~ danielchong$ locate pygame
/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/py2app/recipes/pygame.py
/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/py2app/recipes/pygame.pyc
dchong:~ danielchong$ locate pyopengl
/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/py2app/recipes/pyopengl.py
/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/py2app/recipes/pyopengl.pyc
当我运行 python 时,
Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:17)
[GCC 4.0.1 (Apple Inc. build 5465)] 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
I'll admit I'm completely dumbed by python install. Can someone help me on how to install module
I want to play with PyGame, PyOpenGL etc. So I install them, but I everytime I type "import pygame" error message shows up.
here's my environment so far.
In .bash_profile
PATH=${PATH}:/System/Library/Frameworks/Python.framework/Versions/Current/bin
Using easy_install PyOpenGL placed this
/Library/Python/2.5/site-packages/PyOpenGL-3.0.0b8-py2.5.egg
Locating pygame module
dchong:~ danielchong$ locate pygame
/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/py2app/recipes/pygame.py
/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/py2app/recipes/pygame.pyc
dchong:~ danielchong$ locate pyopengl
/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/py2app/recipes/pyopengl.py
/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/py2app/recipes/pyopengl.pyc
when I run python
Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:17)
[GCC 4.0.1 (Apple Inc. build 5465)] 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先,我并不是 OS X 上默认安装的 python 的忠实粉丝,主要是因为它通常是一个相当旧的版本。 我发现如果我使用 macports 包,一切都会更好。
easy_install 似乎与 macports 包一起使用效果更好,但也许这只是因为我懒得弄清楚默认安装的所有细微差别。
从我所看到的来看,包的路径似乎设置不正确。 您确定您使用的是正确的 site-packages 目录吗?
I'm not a huge fan of the default python install on OS X in the first place, mostly because it's usually a pretty old version. I find everything works better if I use the macports package.
easy_install seems to work better with the macports package, but maybe that's just because I'm too lazy to figure out all the nuances of the default install.
From what I can see there, it looks like the path to the packages isn't set correctly. Are you sure you're using the right site-packages directory?
请参阅 http://farmdev.com/thoughts/66/python-3-0-on-mac-os-x-alongside-2-6-2-5-etc-/
See http://farmdev.com/thoughts/66/python-3-0-on-mac-os-x-alongside-2-6-2-5-etc-/