Setting Virtual Environment in Linux

To set up a Virtual Environment, you first need to install “virtualenvwrapper”.

1
$ pip install virtualenvwrapper

or

1
$ pip easy_install virtualenvwrapper

Setup:
Create a directory to hold the virtual environments.

1
$ mkdir $HOME/.virtualenvs

Now,make a environment variable which has the path of .virtualenvs

1
$ export WORKON_HOME=$HOME/.virtualenvs

Next run the shell script virtualenvwrapper.sh

1
$ source virtualenvwrapper.sh

Run: workon

1
$ workon

A list of environments, empty, is printed.
Run: mkvirtualenv temp. This includes A virtual environment “temp”.

1
$ mkvirtualenv temp.

Run: workon temp.

1
$ workon temp

The virtual environment is activated.

Comments