Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I tell Aptana Studio to use Python virtualenv?

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

like image 340
Bruce Whealton Avatar asked Nov 25 '25 14:11

Bruce Whealton


1 Answers

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.

like image 174
Ajeeb.K.P Avatar answered Nov 28 '25 02:11

Ajeeb.K.P



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!