Virtualenv

Created on March 15, 2013, 8:41 p.m. by Hevok & updated by Hevok on May 2, 2013, 5:14 p.m.

Virtualenv enables to generate isolated python environments.

The current virtualenv version can be check by:

virtualenv --version

To create a virtual environment and to activate execute the following:

virtualenv env
. env/bin/activate

One can create a virtualenv with a different Python version:

virtualenv --python=python2.7 env

Thus, one can have multiple environments to test against different Versions:

virtualenv -p /usr/bin/python3 pyenv
. env/bin/activate
pip install package-name

The Package management system distribute can be explicitly included:

virtualenv --distribute --python=/usr/bin/python2.7 env

The environment is deactivated by simply executing the Statement:

deactivate
virtual-environment.jpg

Tags: coding, programming, python, virtual
Categories: Tutorial
Parent: Python

Update entry (Admin) | See changes

Comment on This Data Unit