#1009126 python3-virtualenv: Virtual environment breaks when default python interpreter is upgraded

#1009126#5
Date:
2022-04-07 14:23:12 UTC
From:
To:
Dear Maintainer,

when creating a virtual environment without explicitly specifying the Python interpreter, the
virtual environment can become unusable, when the default Python version is upgraded with apt.

I.e., creating a new virtualenv with

  virtualenv --prompt 'my_env' venv

creates the following links in the directory venv/bin:

  python -> /usr/bin/python3
  python3 -> python
  python3.10 -> python

When the file /usr/bin/python3 will be upgraded to 3.11, then the Python version changes in the
virtual environment to 3.11 as well. The locally installed packaged become unusable, since they are
installed under "venv/lib/python3.10/site-packages/"

It would be much more robust, to specifically link to versioned Python executable, i.e.:

  python3.10 -> /usr/bin/python3.10
  python3 -> python3.10
  python -> python

Then the user would just need to keep the old Python version installed.

Thanks, dietrich