Virtualenv

Virtualenv is a utility that enables the user to create and use a separate environment for one or more python projects. Using virtualenv in its raw state can lead to a slightly chaotic system with lots of environments in random locations. virtualenvwrapper addresses this objection in an elegant way.

Installing Virtualenv

python -m pip install --user virtualenv

Installing VirtualEnvWrapper

pip install virtualenvwrapper
export WORKON_HOME=~/Envs
mkdir -p $WORKON_HOME
source /usr/local/bin/virtualenvwrapper.sh

or

source ~/.local/bin/virtualenvwrapper.sh

depending on the location of virtualenvwrapper.sh.

If necessary, add the following lines to ~/.bashrc

export WORKON_HOME=~/Envs
source /usr/local/bin/virtualenvwrapper.sh

This will set up the Envs directory as the home for all of you virtualenvs.

Creating a new VirtualEnv

mkvirtualenv <env name>

To list VirtualEnvs

workon

To activate a VirtualEnv

workon <env name>

Site packages

To toggle access to site packages (e.g. wxPython):

toggleglobalsitepackages