我正在尝试安装最新的Mac OS来设置我的编程环境。现在,我要做的是让Pygame与Pydev一起工作,以便可以从Eclipse进行Python编程。到目前为止,我所做的是从python安装了Python 2.6,然后从该站点安装了pygame 1.9。
I'm working off the latest Mac OS trying to set up my programming environment. Right now what I want to do is to get Pygame working with Pydev so I can do my Python programming from Eclipse. What I've done so far is installed Python 2.6 from python and then installed pygame 1.9 from the site.
发生的事情是,当我尝试从命令行运行Python时,我能够顺利导入pygame,但是当我尝试从Eclipse执行相同的操作时,它不起作用。
What happens is that when I try running Python from the command line, I am able to import pygame without a hitch, but when I try to do the same thing from Eclipse, it doesn't work.
我认为可能是因为Pydev不知道在哪里可以找到Python,在这种情况下,我希望获得有关如何确保其指向正确的Python的帮助。
I think it might be because Pydev doesn't know where to find Python, in which case I would like some help on how to make sure it's pointing to the right one.
谢谢!
推荐答案我在Windows上使用Eclipse,但是我认为Mac版本的Eclipse应该是相同的。 在Eclipse中,
I work with Eclipse on Windows, but I believe that the Mac version eclipse should be the same. In Eclipse,
- 单击Windows>首选项,
- 从左侧展开PyDev ,
- 查找解释器-Python,
- 切换到库选项卡,
- 单击右侧的新建文件夹
- 导航到您的pygame路径,然后
- 单击应用并单击确定。
- click Windows > Preferences,
- expand PyDev from left side,
- find Interpreter - Python,
- switch to Libraries tab,
- click New Folder on the right hand,
- navigate to your pygame path, and
- click Apply and OK.
在eclipse中转到您的Python项目,
Turn to your Python project in eclipse,
- 右键单击它,
- 选择PyDev-解释器/语法,
- 选择Python作为项目类型,
- 选择3.0或您从Grammar获得的对应Python版本,
- 最后确保您使用的解释器与您刚刚配置的解释器相同。
- right click on it,
- choose PyDev - Interpreter/Grammar,
- choose Python as Project type,
- choose 3.0 or your correspond Python version from Grammar,
- at last make sure the Interpreter you are using is the same as the one you just configured.
从eclipse构建项目,它应该可以正常工作。
Build your project from eclipse, and it should work.
更多推荐
如何使Pygame与Pydev兼容?
发布评论