1 min read

Bulding a virtualenv

virutalenv

Virutalenv is a python program that allows you to create system separate container with an own version of python/pip. All installed packages(with pip) are store there. This allow a developer to install all necessarily packages into the userspace. It's smoother and allow to have separate version of the same project, for example django. Starting command:
virtualenv --no-site-packages .env
To apply the virtualenv to your local environment run
source .env/bin/activate
(.env)akendo @ akendo :: .../Django
That will change you bash environment to use the python/pip version of the virtualenv. Now you can install you python packages via pip without interfering with other version in the system. An example for our django project, this the list of need packages, all stored in a "requirements.txt" file. To create a requirements.txt, push all the requiert package into the file. You can use the pip freeze command to create file for all installed packages.
 django==1.2.7
 django-celery
 psycopg2
 PIL
 BeautifulSoup
 Markdown
 django-tastypie
 django-oauth
 oauth2
 simplejson
When you have all, just use the -r option to the pip call:
pip install -r path/to/requirements.txt
 
Sources:
Setting up Django virtual environment via python