Matt Seymour

If you run a virtual environment (virtualenv / virtualenvwrapper) at some point you will want to upgrade your python version. As it stands there is no built in way of doing this so the steps below are required to upgrade.

1. Freeze your current virtual environment pip freeze > requirements.txt

2. Remove your existing virtual environment

# if using virtualenvwrapper
rmvirtualenv <environment name>
# virtualenv
rm -r /path/to/virtual/environment

3. Create your new virtual environment

# virtualenvwrapper
mkvirtualenv -p /path/to/python/version <environment name>
# virtualenv
virtualenv -p /path/to/python/version <environment name>

4. Load new virtual environment

# virtualenvwrapper
workon <environment name>
# virtualenv
source /path/to/virtual/environment

5. Install the pip dependencies from requirements.txt

pip install -r /path/to/requirements/file