$ wget https://bootstrap.pypa.io/get-pip.py
$ sudo python3 get-pip.py
$ rm get-pip.py
$ sudo pip install virtualenv virtualenvwrapper
To facilitate using Python virtual environments we'll add the below to the end of our existing ~/.bashrc
file:
# virtualenv and virtualenvwrapper
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
source /usr/local/bin/virtualenvwrapper.sh
Source the ~/.bashrc
file to put the above environment variables and virtual environment settings into effect:
$ source ~/.bashrc
Create and activate a Python virtual environment:
$ mkvirtualenv myenv -p python3
$ workon myenv
Install required modules via requirements.txt
file:
$ pip install -r requirements.txt