如何告诉Aptana Studio使用Python virtualenv? [英] How do I tell Aptana Studio to use Python virtualenv?

查看:327
本文介绍了如何告诉Aptana Studio使用Python virtualenv?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对这个话题做了一些搜索,解决方案对我来说没有效果。我正在运行Linux(Ubuntu)环境和Windows。我的系统是Windows 8.1,但是我已经在Ubuntu上安装了virtualbox。

从Windows开始...我从e驱动器的根目录创建了一个venv目录。创建一个项目文件夹,然后运行activate命令,它在venv> Scripts目录中。所以,激活后(注意,我已经安装了virtualenv)...所以在激活后,然后我改成了我的模块的文件夹,它运行良好,与shebang,我甚至没有在前面打python的文件名然而,在Aptana Studio中,它找不到与pip一起安装的模块。所以,它不行。在较早的帖子中,建议您选择一个不同的解释器并浏览到env并选择它。



那么,如何安装并使用IDE,如Eclipse和Aptana Studio?



在Ubuntu上有问题。我发现使用包安装程序来安装virtualenv,pip和其他一些打包这些工具的说明。问题是在Ubuntu上,默认版本的python是2.7.x.我需要3.3或3.x。所以,有人可以指出我如何为python和3.x分支的2.7.x分支设置虚拟环境。



另外,如何告诉IDE(Eclipse或Aptana Studio)使用virtualenv?
感谢
Bruce

解决方案

配置Aptana Studio的python解释器(您可以配置多于一个)



在aptana中,窗口 - >首选项 - >解释器Python ,并创建一个翻译。从虚拟环境中选择python可执行文件(在Windows中是 python.exe ,它驻留在virtualenv的脚本子文件夹中,其中ubuntu python在 bin 子文件夹)。现在,Aptana将会显示一个要添加的目录列表,还要记住检查 C:\Python27\Lib 或Ubuntu conterpart。



现在开始创建使用此解释器。



或者如果与现有项目一起使用



步骤1.获取项目属性(文件 - >属性或By右键单击项目)



步骤2.从 PyDev解释器/语法选择您上面配置的解释器。



编辑:



这样,您甚至可以为Aptana配置python 3和python 2。您必须为每个python 3和python 2配置一个解释器。然后按照上述步骤选择解释器。


I did some searches on this topic and the solutions didn't work for me. I am running both a Linux (Ubuntu) environment and Windows. My system is Windows 8.1 but I have virtualbox with Ubuntu on that.
Starting with Windows... I created a venv directory off the root of the e drive. Created a project folder and then ran the activate command, which is in the venv>Scripts directory. So, after activating that (note, I had installed virtualenv already)... so after activating that I then changed into the folder with my module and it ran fine, with the shebang, I didn't even have to type python in front of my filename. However, in Aptana Studio, it cannot find the module I installed with pip. So, it doesn't work. In an earlier post it was recommended that one choose a different interpreter and browse to the env and select that.

So, how does one get this installed and working with an IDE like Eclipse and Aptana Studio?

I am having problems on Ubuntu. The instructions I found had me using package installer to install virtualenv, pip and a few other tools that package these. The problem is that on Ubuntu the default version of python is 2.7.x. I need 3.3 or 3.x. So, can someone point me in the direction of how to setup virtual environments for the 2.7.x branch of python and the 3.x branch.

Also, how does one tell the IDE (Eclipse or Aptana Studio) to use the virtualenv? Thanks, Bruce

解决方案

Configure Aptana Studio's python interpreter( you can configure more than one)

In aptana, Window -> Preferences -> Interpreter Python and create a New interpreter. Select the python executable from the virtual environment (in windows it is python.exe which resides in Scripts subfoler of the virtualenv,where as in ubuntu python is under bin subfolder) . Now Aptana will show a list of directories to add also remember to check C:\Python27\Lib or Ubuntu conterpart.

Now on creating use this interpreter.

Or if to use with existing project

Step 1.Take project properties(File -> Properties OR By right clicking on Project).

Step 2.From PyDev Interpreter/Grammer select the interpreter you configured above.

Edit :

In this way you can even configure both python 3 and python 2 for Aptana. You have to configure an interpreter for each python 3 and python 2. Then follow steps above to select the interpreter.

这篇关于如何告诉Aptana Studio使用Python virtualenv?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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