Install virtualenvwrapper.

Here’s how I install it on Mac.

PIP_REQUIRE_VIRTUALENV=false pip3 install --user --upgrade virtualenvwrapper

Add the following to your startup script (e.g. ~/.zshenv, ~/.bashrc):

export WORKON_HOME=~/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/opt/local/bin/python3.8
export VIRTUALENVWRAPPER_VIRTUALENV=~/Library/Python/3.8/bin/virtualenv
source ~/Library/Python/3.8/bin/

Source your startup script to bring the changes into your environment:

source ~/.zshenv


To create a virtualenv:

mkvirtualenv -p $(which python3.6) my_virtualenv

It’s important to specify the specific Python version to use for your specific project. Install multiple versions of Python into your system to use for different projects.

The virtualenv is created and activated. Install packages into it.

pip install ...

To deactivate the virtualenv:


To reactivate it:

workon my_virtualenv

To delete the virtualenv (must be inactive):

rmvirtualenv my_virtualenv