Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Workflow using virtualenv and pip

I have python2.6 and django1.2.3 already installed on my system (Ubuntu 10.x).
This is the setup i use for most of my projects. But for some projects I need sandboxed environments, different django version, some extra python modules and sometimes even different python version.

So, I am trying to use pip and virtualenv now,but I am unable to change python and django version. Will I have to remove default setup and move all existing projects into 1 virtualenv. Can I avoid this? Even if I do that, how can I specify a different version of python?

If I have to remove the old settings. How do i do that? I have currently most of the things installed in /usr/local/lib/python2.6/dist-packages/ but I am not sure if there is anything installed anywhere else also.

If I have a completely blank setup with just Ubuntu, what is the ideal workflow? Is it this one?

Install python
$ sudo apt-get install python-setuptools 
$ sudo apt-get install python-virtualenv 
$ sudo easy_install pip
$ sudo pip install virtualenvwrapper 
like image 301
Ajay Yadav Avatar asked Jan 14 '11 17:01

Ajay Yadav


1 Answers

You want to do:

virtualenv --python=/path/to/python/version --no-site-packages ENV_NAME

For example:

virtualenv --python=/usr/bin/python2.6 --no-site-packages my_project_env

If you follow this for your projects you should be able to have a separate configuration for each one.

like image 119
minichate Avatar answered Sep 18 '22 22:09

minichate