Context: After updating from Debian 8 to 9, Python 3.4 virtualenvs stopped working because system site-packages were all replaced by the Python 3.5 version. This answer suggests removing the old virtualenv, creating a new one, and reinstalling all packages using pip install -r requirements.txt. However, I don't have a requirements.txt for all virtualenv. I know that such file can be created with pip freeze, but for the reason stated above, pip won't work1.
Problem: I need to generate a list of the packages and their respective installed in a virtualenv that I cannot activate.
Question: Is there a way to get a list similar to the output of pip freeze for a virtualenv without actually running pip?
Note: This question is different from “Return a list of imported Python modules used in a script?” and because the requested answers should not need to access the scripts that use the virtualenv, and should also return the versions of the packages installed in the virtualenv2.
1 Namely, running pip (with any parameters) raises ImportError: No module named 'encodings'.
2 Full disclosure: I asked a similar question that was wrongly closed as duplicate.