This is if you have both the versions installed.

Go to This PC โ†’ Right-click โ†’ Click on Properties โ†’ Advanced System Settings.

You will see the System Properties. From here navigate to the Advanced Tab -> Click on Environment Variables.

You will see a top half for the user variables and the bottom half for System variables.

Check the System Variables and double-click on the Path (to edit the Path).

Check for the path of Python(which you wish to run i.e. Python 2.x or 3.x) and move it to the top of the Path list.

Restart the Command Prompt, and now when you check the version of Python, it should correctly display the required version.

Answer from Aditya Deshpande on Stack Overflow
Top answer
1 of 16
191

This is if you have both the versions installed.

Go to This PC โ†’ Right-click โ†’ Click on Properties โ†’ Advanced System Settings.

You will see the System Properties. From here navigate to the Advanced Tab -> Click on Environment Variables.

You will see a top half for the user variables and the bottom half for System variables.

Check the System Variables and double-click on the Path (to edit the Path).

Check for the path of Python(which you wish to run i.e. Python 2.x or 3.x) and move it to the top of the Path list.

Restart the Command Prompt, and now when you check the version of Python, it should correctly display the required version.

2 of 16
120

The Python installer installs Python Launcher for Windows. This program (py.exe) is associated with the Python file extensions and looks for a "shebang" comment to specify the python version to run. This allows many versions of Python to co-exist and allows Python scripts to explicitly specify which version to use, if desired. If it is not specified, the default is to use the latest Python version for the current architecture (x86 or x64). This default can be customized through a py.ini file or PY_PYTHON environment variable. See the docs for more details.

Newer versions of Python update the launcher. The latest version has a py -0 option to list the installed Pythons and indicate the current default. py -h lists complete Python Launcher options as well as Python options.

Here's how to check if the launcher is registered correctly from the console:

C:\>assoc .py
.py=Python.File

C:\>ftype Python.File
Python.File="C:\Windows\py.exe" "%1" %*

Above, .py files are associated with the Python.File type. The command line for Python.File is the Python Launcher, which is installed in the Windows directory since it is always in the PATH.

For the association to work, run scripts from the command line with script.py, not "python script.py", otherwise python will be run instead of py. If fact it's best to remove Python directories from the PATH, so "python" won't run anything and enforce using py.

py.exe can also be run with switches to force a Python version:

py -3 script.py       # select latest Python 3.X version to be used.
py -3.6 script.py     # select version 3.6 specifically.
py -3.9-32 script.py  # select version 3.9 32-bit specifically.
py -0                 # list installed Python versions (latest PyLauncher).

Additionally, add .py;.pyw;.pyc;.pyo to the PATHEXT environment variable and then the command line can just be script with no extension.

Discussions

Switching between versions of python installed from microsoft store
When you install Python from the ... Store version of Python, you should use the python3 (or python3.7) command. Hope that helped. Please let us know if you have further questions. ... For information please read this FAQ doc for using python on windows.... More on learn.microsoft.com
๐ŸŒ learn.microsoft.com
1
0
February 8, 2021
How to change default python in `py-launcher` at windows?
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 ... More on discuss.python.org
๐ŸŒ discuss.python.org
3
0
May 20, 2022
Switching between Python versions
I'll demonstrate assuming you're on Linux/OS-X. It's probably similar in Windows, but I've always had a painful experience using python with external libraries in Windows. I'll skip over pycharm because I haven't used that, so maybe someone can help explain how to use a virtualenv with pycharm. $ virtualenv -h Usage: virtualenv [OPTIONS] DEST_DIR ... -p PYTHON_EXE, --python=PYTHON_EXE The Python interpreter to use, e.g., --python=python2.5 will use the python2.5 interpreter to create the new environment. The default is the interpreter that virtualenv was installed with (/usr/bin/python) $ virtualenv -p /usr/bin/python3.3 testing_dir Running virtualenv with interpreter /usr/bin/python3.3 Using base prefix '/usr' New python executable in testing_dir/bin/python3.3 Also creating executable in testing_dir/bin/python Installing Setuptools..............................................................................................................................................................................................................................done. Installing Pip.....................................................................................................................................................................................................................................................................................................................................done. $ source testing_dir/bin/activate (testing_dir)$ From there you can pip install $PACKAGE without sudo and it'll go into your virtual environment. Make sure you don't use sudo. Use the command deactivate to exit the virtualenv. Inside the virtualenv, you can install whatever you want, use whichever python executable you want, and not worry about tainting your system with strange libraries. This does not necessarily make things more secure. You are still running remote code, but at least not as root, and not putting it into your /usr/lib. This is great for running a project purely with the set of packages you decide at the time, and you can capture those with pip freeze > requirements.txt. Later, someone can install all of them with pip install -r requirements.txt. It really helps with distributing packages and keeping the environment similar. More on reddit.com
๐ŸŒ r/Python
16
3
September 4, 2014
Change python version
I can't read French and can't easily translate that on my phone in a rush, but if you want to use a specific version you can do so via py: py -3.8 -m pip install bcml On Windows that's usually a good solution, as you can then have any number of Python versions installed and use whatever floats your boat. More on reddit.com
๐ŸŒ r/learnpython
3
3
December 17, 2022
๐ŸŒ
Reddit
reddit.com โ€บ r/learnpython โ€บ change actual python-version in cmd?
r/learnpython on Reddit: Change actual python-version in cmd?
May 21, 2024 -

Generally i was using the latest python version 3.12. in my terminalk
So when i created a virtual environment with

python -m venv xyz

the created virtual environment was under 3.12

For testing purposes it was now necessary to also install python version 3.9.

But now when i am using venv to create a new virtual environment it is the version 3.9.

How can i change the "standard" python-version bakc to 3.12. when i am creating a virtual environment using venv?

๐ŸŒ
Astral
docs.astral.sh โ€บ uv โ€บ concepts โ€บ python-versions
Python versions | uv
2 weeks ago - On Windows, the Python interpreters in the Windows registry and Microsoft Store Python interpreters (see py --list-paths) that match the requested version.
๐ŸŒ
DigitalOcean
digitalocean.com โ€บ community โ€บ tutorials โ€บ install-python-windows-10
How to Install Python on Windows | DigitalOcean
September 26, 2025 - Yes, you can install multiple versions ... 3.8, 3.10, and 3.12 installed at the same time. To manage and switch between these versions, Windows uses the Python Launcher (py.exe)....
Find elsewhere
๐ŸŒ
Python
docs.python.org โ€บ 3 โ€บ using โ€บ windows.html
4. Using Python on Windows โ€” Python 3.14.3 documentation
This is a standalone tool that makes Python available as global commands on your Windows machine, integrates with the system, and supports updates over time. You can download the Python Install Manager from python.org/downloads or through the Microsoft Store app. Once you have installed the Python Install Manager, the global python command can be used from any terminal to launch your current latest version of Python.
๐ŸŒ
C# Corner
c-sharpcorner.com โ€บ article โ€บ how-to-manage-multiple-versions-of-python-on-windows-11
How To Manage Multiple Versions Of Python On Windows 11
April 13, 2022 - You can download the installer for Python 3.10 here. You can learn to install python3 on Windows here. We will now create copies of the python executable and rename them to python27 and python310. This is necessary so that system knows the python version to run.
๐ŸŒ
Quora
quora.com โ€บ How-do-I-change-the-Python-version-in-CMD
How to change the Python version in CMD - Quora
Answer: itโ€™s a long process but if you want you can give it a try Python 3.3 introduces Python Launcher for Windows that is installed into [code ]c:\Windows\[/code] as [code ]py.exe[/code] and [code ]pyw.exe[/code] by the installer. The installer also creates associations with [code ].py[/code] ...
๐ŸŒ
Chocolatey
community.chocolatey.org โ€บ packages โ€บ python
Chocolatey Software | Python 3.15.0-a7
Python is a programming language that lets you work more quickly and integrate your systems more effectively. You can learn to use Python and see almost immediate gains in productivity and lower maintenance costs. This package depends on the the latest major version of python package.
๐ŸŒ
Python documentation
docs.python.org โ€บ 3 โ€บ library โ€บ venv.html
venv โ€” Creation of virtual environments
A virtual environment may be โ€œactivatedโ€ using a script in its binary directory (bin on POSIX; Scripts on Windows). This will prepend that directory to your PATH, so that running python will invoke the environmentโ€™s Python interpreter and you can run installed scripts without having to use their full path. The invocation of the activation script is platform-specific (<venv> must be replaced by the path to the directory containing the virtual environment): Added in version 3.4: fish and csh activation scripts.
๐ŸŒ
Python.org
discuss.python.org โ€บ python help
How to change default python in `py-launcher` at windows? - Python Help - Discussions on Python.org
May 20, 2022 - 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-bโ€ฆ
๐ŸŒ
Visual Studio Marketplace
marketplace.visualstudio.com โ€บ items
Python - Visual Studio Marketplace
Visual Studio Code>Programming Languages>PythonNew to Visual Studio Code?
๐ŸŒ
Real Python
realpython.com โ€บ installing-python
How to Install Python on Your System: A Guide โ€“ Real Python
February 18, 2026 - Note: To learn more about your ... type in the following command and press the Enter key: ... Using the --version switch will show you the installed version....
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ python_virtualenv.asp
Python Virtual Environment - venv
Python Variables Variable Names Assign Multiple Values Output Variables Global Variables Variable Exercises Code Challenge Python Data Types
๐ŸŒ
Mostly Python
mostlypython.com โ€บ updating-python
Updating Python
August 7, 2025 - This alias will only last as long as that terminal window is open, and I can unset it or point it to a different interpreter any time I need. One of my long-term goals has been to more consistently update my Python versions as new point releases come out.
๐ŸŒ
Brainly
brainly.com โ€บ computers and technology โ€บ high school โ€บ how do you set the default python version on windows?
[FREE] How do you set the default Python version on Windows? - brainly.com
November 27, 2023 - To set the default Python version on Windows, modify the 'Path' variable in environment variables to move your preferred Python version to the top. This ensures that when you type 'python' in Command Prompt, the system recognizes the correct version.