George Sovetov George Sovetov - 1 month ago 8
Python Question

How to use different Python version in venv from standard library? (Not virtualenv!)

I have installed Python 3.4.0 and created virtual environment with

python -m venv myenv
. How can I change Python version in my virtual environment? Documentation says:


Each virtual environment has its own Python binary (allowing creation
of environments with various Python versions) and can have its own
independent set of installed Python packages in its site directories.


UPDATE

Please, note that I ask about venv from standard library, not about virtualenv.
Let me provide some links.



I don't see something like a
--python
flag in venv.

Are venv and virtualenv absolutely similar?
Are venv is so unpopular and no one uses it so that virtualenv remains the standard?

Answer

It's simply impossible. To create python venv of specific Python version, we need this specific version.

Obviously, Python interpreter doesn't contain all previous versions. Python 3.4.1 doesn't contain Python 2.7.8 executable anywhere inside.