如何使Pygame与Pydev兼容?

编程入门 行业动态 更新时间:2024-10-22 19:30:28
本文介绍了如何使Pygame与Pydev兼容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试安装最新的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兼容?

本文发布于:2023-10-13 10:20:56,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1487682.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Pygame   Pydev

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!