在Eclipse中为不同的项目使用不同版本的python [英] Using different versions of python for different projects in Eclipse

查看:165
本文介绍了在Eclipse中为不同的项目使用不同版本的python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我慢慢地在一些Python 3.0中工作,但是我依然有很多依赖2.5的东西。但是,在Eclipse中,每次在3.0和2.5之间更改项目时,我需要经历



项目 - >属性 - >项目类型。



问题1:如果我只是在下拉框中切换解释器,似乎没有改变任何东西。我需要点击点击此处配置未列出的口译员,然后点击 UP 我要使用的口译员。



问题2:如果我在过去的一段时间内为每个项目切换到3.0,那么这个就好了,但是我还在做很多项目之间的转换,我看不到即将改变。所以,我只是想保存一些操作。



有没有办法配置Eclipse,以便它记住我想要哪个解释器与哪个项目相关联?



如果我创建了一个全新的工作区,该怎么办? 解释器是工作空间的属性吗?另外,当我通过文件 - >新建 - > Pydev项目创建一个新的项目时,我选择什么也不重要。无论我最后通过属性选择的是eclipse正在使用的。



这是在Windows XP中运行的Eclipse 3.4.0。

解决方案

您可以通过运行配置菜单在每个脚本的基础上设置解释器版本。



要执行此操作,请运行 - >运行配置,然后在Python Run下创建一个新条目。填写您的项目名称和主要脚本,然后转到Interpeter选项卡,您可以选择要用于该脚本的解释器。



我已经使用这样就可以在同一个工作空间中使用Python 2.2,2.5和3.0项目。


So, I'm slowly working in some Python 3.0, but I still have a lot of things that rely on 2.5.

But, in Eclipse, every time I change projects between a 3.0 and a 2.5, I need to go through

Project -> Properties -> project type.

Issue 1: if I just switch the interpreter in the drop down box, that doesn't seem to change anything. I need to click "click here to configure an interpreter not listed", and UP the interpreter I wish to use.

Issue 2: That would be fine if I was switching to 3.0 for every project for the rest of my life, but I still am doing a lot of switching between projects and I don't see that changing anytime soon. So, I'm just trying to save a few operations.

Is there a way to configure Eclipse so that it remembers which interpreter I want associated with which project?

What if I created an entirely new workspace? Is "interpreter" a property of a workspace?

Also, it doesn't seem to matter what I choose when I create a new project via File -> New -> Pydev Project. Whatever I last selected through "Properties" is what eclipse is using.

This is Eclipse 3.4.0, running in Windows XP.

解决方案

You can set the interpreter version on a per-script basis through the Run Configurations menu.

To do this go to Run -> Run Configurations, and then make a new entry under Python Run. Fill in your project name and the main script, and then go to the Interpeter tab and you can pick which interpreter you want to use for that script.

I've used this to have Python 2.2, 2.5, and 3.0 projects in the same workspace.

这篇关于在Eclipse中为不同的项目使用不同版本的python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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