Setup a virtualenv using virtualenvwrapper

Install virtualenvwrapper and create your first virtualenv

Install virtualenvwrapper

sudo pip3 install virtualenvwrapper

Edit your bashrc file and add te following content.

export WORKON_HOME="$HOME/virtualenvs"
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
source /usr/local/bin/

Then run.

source ~/.bashrc

Create a virtualenv.

mkvirtualenv env1

Setup .bashrc config

Add the following lines in your ~/.bashrc file.

# Virtualenvs
export WORKON_HOME=~/virtualenvs
source /usr/local/bin/

Useful commands

Change virtualenv

 workon yourvirtualenvname 

"Logout" from a virtualenv


"cd" to your virtualenv automatically

Run this only one time.

workon yourvirtualenvname
echo 'cd $VIRTUAL_ENV' >> $WORKON_HOME/postactivate


Last updated