A collection of my notes. Provided as is with no warranty of any kind expressed or implied.
Virtualenv is a part of everyday life. However it can be painful to manage a ton of virtual environments. Without careful management, adding virtual environments all over the place can cause clutter in version control.
virtualenvwrapper allows storing as many virtual environments as you need in a single non-project location. It provides commands to create, edit, switch, and remove virtual environments.
$ sudo apt-get install python-pip
$ sudo pip install virtualenv
$ mkdir ~/.virtualenvs
At this point virtualenv is setup with the standard commands. The following instructions are to setup the virtualenvwrapper.
$ sudo pip install virtualenvwrapper
$ export WORKON_HOME=~/.virtualenvs
Add this line to the end of ~/.bashrc so that the virtualenvwrapper commands are loaded.
$ . /usr/local/bin/virtualenvwrapper.sh
Exit and re-open your shell, or reload .bashrc with the command
$ source ~/.bashrc and you should be ready to go.
$ mkvirtualenv myprojectenv
to exit your new virtualenv, use deactivate as normal.
To load or switch between virtualenvs, use the workon command:
$ workon myprojectenv