How to use Virtualenv

I came back to Japan and now work on SDN stuff. So I need to learn the Open stack, mainly Neutron which is written in python, using DeployPaste. I'm supposed to be familiar with python and relative things so at first I re-learned the virtualenv / virtualenvwrapper.

What is virtualenv / virtualenvwrapper?

Virtualenv enable us to have multiple python environments in a machine. We can run multiple python versions with different package sets.

Virtualenvwrapper is a wraper for virtualenv literally. This can be used under Linux environment.

How to install?

pip install virtualenv
pip install virtualenvwrapper 

Usage of Virtualenvwrapper

Prerequisites
  • Setting up WORKON_HOME
mkdir ~/.virtualenvs
export WORKON_HOME=~/.virtualenvs
  • Read virtualenvwrapper.sh
source `which virtualenvwrapper.sh`
How to make / delete virtual environment
mkvirtualenv <env name>
rmvirtualenv <env name>
How to list virtual env names / how to enter(exit) a specified virtual env
workon  # list of virtualenvs
workon <env name> # entering virtualenv 
deactivate # exit from the current virtualenv