I upgraded Python on my system from Python 3.5 to 3.6, and now all my virtualenvs created in Python 3.5 are no longer usable. How can I get a list of packages installed in a Python 3.5 virtualenv when I have only Python 3.6 installed? I need to setup a new Python 3.6 virtualenv with the same packages as in the old Python 3.5 virtualenv.
I know that I can look inside the lib/python3.5/site-packages
directory and make the list manually, but I would prefer an automatic way of running e.g. pip freeze
against the old virtual environment. I would prefer not to re-install the old version of Python.
I have tried the python -m venv --upgrade
command, which has the help text "Upgrade the environment directory to use this version of Python, assuming Python has been upgraded in-place.". However, this doesn't actually reinstall the packages in the virtualenv, it just creates an essentially empty directory named lib/python3.6/site-packages
. Furthermore, I had to remove the broken symlink bin/python3.5
in the venv in order to even run python -m venv --upgrade
against the old virtualenv.