With virtualenvwrapper (user friendly wrappers for the functionality of virtualenv)

Install pip

Install pip for Python 2 with

sudo apt-get install python-pip

or for Python 3

sudo apt-get install python3-pip

Optional: Turn on bash autocomplete for pip

Run

pip completion --bash >> ~/.bashrc

and run source ~/.bashrc to enable.

Install virtualenv

Install virtualenv with

sudo apt-get install virtualenv

Use pip to install virtualenvwrapper

The reason we are also installing virtualenvwrapper is because it offers nice and simple commands to manage your virtual environments. Because we want to avoid sudo pip we install virtualenvwrapperlocally (by default under ~/.local):

pip install --user virtualenvwrapper

or for Python 3

pip3 install --user virtualenvwrapper

and

echo "export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3" >> ~/.bashrc