如何使Pygame与Pydev兼容? [英] How can I make Pygame work with Pydev?

查看:90
本文介绍了如何使Pygame与Pydev兼容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试安装最新的Mac OS来设置我的编程环境。现在,我要做的是让Pygame与Pydev一起工作,以便可以从Eclipse进行Python编程。到目前为止,我所做的是从python.org安装了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.org 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兼容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆