Nov-06-2019, 06:06 PM
The solution is to use pyenv (see: https://python-forum.io/Thread-pyenv-Sim...ight=pyenv )
If it's just for one virtual environment version, start a pyenv shell, selecting desired version, and then create the virtual env:
For a test case, assume global python version is 3.8 and you want a virtual environment that uses 3.7.4
From command line:
you can globally change the python version to any installed version with:
If it's just for one virtual environment version, start a pyenv shell, selecting desired version, and then create the virtual env:
For a test case, assume global python version is 3.8 and you want a virtual environment that uses 3.7.4
From command line:
pyenv shell 3.7.4 python -m venv venvOnce created, you can exit the shell and then just activate the virtual environment normally, the set python version (3.7.4) in this instance will remain, even though your global python version is 3.8 or some other version.
you can globally change the python version to any installed version with:
pyenv global 3.7.4