Hello, I tried to install multiple python versions on my windows machine, I have this version:
❯ py --list
-V:3.11 * Python 3.11 (64-bit)
-V:3.10 Python 3.10 (64-bit)
-V:3.9 Python 3.9 (64-bit)
How do I change the default python version to 3.10 when I type
py in terminal?
because if I type
py it’s always choosing the latest version (3.11). The
--help args don’t give a meaningful message on how to change the default version like
pyenv do. or I miss something?
The docs have a section on customization. You can either set up a .ini file or you can set an environment variable.
If you don’t have either one (or you don’t use command line flags like
py -3.10), it just picks the most recent version.
Using different Python versions in one computer is cumbersome, but when you also need different modules or module-versions installed, it becomes a nightmare.
The solution is to use a Python Virtual Environment. Easier to do than it seems; look e.g. into: HOWTO - Using Python in a virtual Environment on Linux
I run any Py version from 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, and even simultaneously, if I have to.