If you use the python3 name then set the PATH so that your preference is first. If you use the py command then you can edit py’s py.ini file to set the preference. This is what I do on my Windows systems. See the python windows does for details. Answer from barry-scott on discuss.python.org
🌐
Python.org
discuss.python.org › python help
How can I set the default Python version that gets launched when typing python3 (On Windows 11)? - Python Help - Discussions on Python.org
March 10, 2026 - Overview My exact goal is to set my preferred version of python as the default when I type python3 into a command prompt or powershell prompt. I’ve tried everything but can’t figure it out. I have the following Python versions installed (Output of py -0p): -V:3.14[-64] C:\Users\user\AppData\Local\Python\pythoncore-3.14-64\python.exe -V:3.13[-64] * C:\Users\user\AppData\Local\Python\pythoncore-3.13-64\python.exe -V:3.12[-64] C:\Users\user\AppData\Local\Python\pythoncore-3.12-64\python...
🌐
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?

🌐
TechBloat
techbloat.com › home › how to change python version in cmd
How to Change Python Version in CMD - TechBloat
February 27, 2026 - Search for “Environment Variables” in Windows Search and select “Edit the system environment variables.” ... Add the path to the Python executable of the desired version, e.g., C:\Python38\. After updating, restart CMD. Typing python –version should now display the version you’ve ...
🌐
Reddit
reddit.com › r/learnpython › how to set default version when multiple versions are installed
r/learnpython on Reddit: How to set default version when multiple versions are installed
June 8, 2022 -

I have both 3.10 and 3.11b3 installed on my windows 10 machine. I'd like py.exe to launch 3.10.

I had read that I should create py.ini and pyw.ini in both \windows and C:\Users<user>\AppData\Local\Programs\Python\Launcher\ and the files should contain:

[defaults]
python=3.10

I've done this, but py.exe launches 3.11b3. I don't have any other py.ini files. How do I fix this so \windows\py.exe launches my preferred default version?

EDIT: see https://stackoverflow.com/questions/68121982/multiple-python-versions-installed-how-to-set-the-default-version-for-py-exe

I could use py -3.10 to launch, but from the link there should be a way to just use py

Find elsewhere
🌐
H2S Media
how2shout.com › home › coding › set python 3 as your default “python version” on windows 10/11
Set Python 3 as your default "Python Version" on Windows 10/11
January 17, 2023 - Learn how to resolve multiple Python version issues by making Python 3 as the default one on Windows 10 or 7 via Environmental variables.
🌐
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-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).
🌐
Medium
medium.com › @dandi.mahendris › set-up-different-python-version-in-windows-1d5cf3b652dd
Set-up Different Python version in Windows | by Dandi Mahendris | Medium
July 25, 2023 - Please be informed to move up or move down to select the default python on global environment. ... Python 3.11: $ python -m virtualenv --python python311 venv311 Python 3.10: <---------- $ python -m virtualenv --python python310 venv310 ... How to Set Up a Virtual Environment With a Different Python Version on Windows | by David Littlefield | The Startup | Medium
🌐
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.
Top answer
1 of 4
9

You can run multiple python versions on your machine.

To make Python 3.6 default, just put path of Python 3.6 before path of Python 3.4 in system variables.

OR

In python34 directory on C drive rename python.exe to python3.4.exe. After doing this if you run command python in command prompt it will open python 3.6. And to run python 3.4 you need to run command python3.4 as we have renamed it to python3.4.exe in python34 directory.

After making changes in system variables in environment variables you just need to restart your command prompt. No need to restart machine.

2 of 4
3

After doing a restart of my machine after deleting python34 from my system path variables as @Talha Junaid mentioned in the comments, my python now defaults to python3.6 when accessed through command prompt, windows must load all the path variables on startup and hold them in memory until a restart occurs.


Steps for anyone else starting the process.

Windows 10

  1. Type "System" into the search bar to go to system settings in the control panel (Control Panel\All Control Panel Items\System)

  2. Click "Advanced System Settings" -> "Environment Variables"

For User Variables:

  1. Highlight the row for "Path" by clicking on it and then click the "Edit" button
  2. Highlight by clicking the version of python you want to remove from your environment variables and then click the "Delete" button.

Repeat steps 3 and 4 for System Environment Variables.

  1. Close all the windows by clicking the "OK" buttons

  2. Restart your machine

🌐
WittySparks
wittysparks.com › technology › programming › easy steps to make python3 version default in windows os
The best way to make Python3 version default in Windows OS
November 27, 2025 - To make Python 3 available for Windows OS, edit environment variables to add Python 3 to the path. Click OK. Open Command Prompt. Upgrade pip to be able to install Python modules.
Top answer
1 of 3
15

If anyone is looking for this in 2023:

Goto your Environment Variables....

Under System variables, look for the variable PY_PYTHON. If it exists, you can change its value to the version of Python you want to use by default (for example, 3.10 or 3.11). If it doesn't exist, you can create it by clicking on New..., entering PY_PYTHON as the variable name, and the desired Python version as the variable value.

Click OK to apply the changes.

To verify your changes, open a new command prompt and type py. It should start the Python interpreter in the version you specified.

2 of 3
7

To set the default version of Python, you need to have installed Python Launcher (cf below for some info). If you didn't, you can probably install it by using the installation .exe of one of your Python installations, and selecting modifying/repair.

You also need to know where your Python Launcher is:

  • if you installed it for all users, it is in C:\WINDOWS\,
  • if not, it is in %USERPROFILE%\AppData\Local\Programs\Python\Launcher\.

In this example, the latest installed version of Python is Python 3.11 but the version that should be the default one is Python 3.6.


To set a default Python version:

  • go to your Python Launcher Folder and create 2 files: py.ini and pyw.ini

  • make sure that both of these files are UFT-8 (they shouldn't be UFT-8 with BOM)

  • add to each of these files:

     [defaults]   
     python=3.6
    
  • now, right click on any .py, select open with, select check another app, check Always use this app..., scroll all the way down and click on more app... and navigate to your Python Launcher folder and select the py.exe.

  • do the previous step again but this time, right-click on a .pyw file and select the pyw.exe.


How to use it

● in a CMD:

  • Do not use anymore python in CMD, always use py. If you type just py, then it will open a Python 3.6 console. If you want a Python 3.11 console, type py -3.11.

  • As indicated in the comment by @karl-knechtel: If you have an active venv, using python instead of py` will prioritize the venv's Python, which is generally what you want.

  • To use pip to install :

    py -3.11 -m pip install # will install package for 3.11 py -m pip install # will install package for 3.6

● For python files:

  • If the file doesn't contain a shebang, then it will be started with the default Python version which is 3.6.
  • To use Python 3.11 for this file, add the shebang #!python3.11 at the very top of your script

To verify that everything is working:

  • open a CMD, write py -0p and look for the *. It should be next to the default version you have set in the .ini files.

    Installed Pythons found by py Launcher for Windows
    -3.11-64 C:\Users<user>\AppData\Local\Programs\Python\Python39\python.exe
    -3.6-64 C:\Users<user>\AppData\Local\Programs\Python\Python36\python.exe *

  • With this setup, you can use the specific version of Python that you need in your scripts:

    • 3.6 (as it will call the default version)

      import sys   
      print(sys.version_info)  
      input("close")  
      
    • 3.6 (as it will call the default)

      #!python   
      import sys   
      print(sys.version_info)   
      input("close")   
      
    • 3.11

      #!python3.11   
      import sys  
      print(sys.version_info)   
      input("close")   
      
    • 3.11 (as it is the latest python 3 installed)

      #!python3    
      import sys   
      print(sys.version_info)   
      input("close")   
      

Some info about the Python launcher from docs.python.org

The Python launcher for Windows is a utility which aids in locating and executing of different Python versions. It allows scripts (or the command-line) to indicate a preference for a specific Python version, and will locate and execute that version. Unlike the PATH variable, the launcher will correctly select the most appropriate version of Python. It will prefer per-user installations over system-wide ones, and orders by language version rather than using the most recently installed version.

Two .ini files will be searched by the launcher - py.ini in the current user’s “application data” directory [...] and py.ini in the same directory as the launcher. The same .ini files are used for both the ‘console’ version of the launcher (i.e. py.exe) and for the ‘windows’ version (i.e. pyw.exe).

Customization specified in the “application directory” will have precedence over the one next to the executable, so a user, who may not have write access to the .ini file next to the launcher, can override commands in that global .ini file.

⚠ Your python version can be installed either for all user (python.exe will be in program files) or for the profile (python.exe will be in appdata). If it doesn't work, try uninstalling all python version, and the launcher and reinstall everything as current user to start clean. To do that, download the .exe of your current Python installation, run it and click on uninstall (dont delete the remaining folder in app data if you want to keep your python packages), then reinstall it. If you install the launcher for all users but python for current user, your python.exe will be in appdata (a folder for each version), and your launcher will be C:\Windows\py.exe

If you want to install it for all "all users" and the check box is grayed out: you need first to uninstall the python launcher. If it's still grayed uninstall the python version(s) that remains (everything wil be in program files).

Top answer
1 of 8
32


As you can see, I have both Python2 and Python3 installed.


I hope you know that the path of the python executable has to be added to the PATH environment variable in Windows. As you can see, the path of Python2 is placed above the path of Python3 in my system.

How does the cmd run commands?
It searches for an executable with the same name in the directory the cmd has been opened in, then goes and searches for the command in the locations provided in the Windows PATH variable, from TOP to BOTTOM. Which means, it gets the path to Python2 before it can get to the path of Python3. Therefore, every time you type python in your cmd, it runs Python2.
Both Python2 and Python3 executables have the same name in Windows so it never runs python3.

What seems like an obvious solution?
You might think, changing the name of python.exe to python3.exe for the Python3 executable will solve your problem. You are partially right, it will work. But you have to use python3 file.py or python3 --version, which I think, is understandable. But, pip will no longer work if you change the name of the original python executable. You will no longer be able to install external packages and modules.

How can this problem be solved?
You can create an alias for the Python3 executable called python3.bat.
.exe and .bat files can be called from the cmd directly without using their extension. We always write python filename.py instead of python.exe filename.py although both are correct. The same can be done with .bat files.
Go back to the first image and notice the python3.bat file below python.exe. That is my way of calling python3 without renaming my original python executable.

python3.bat
Create a new file using notepad or something and paste this %~dp0python %*
I don't fully understand how this works except that dp0 basically runs python from inside the same directory and %* passes all the arguments to the python executable. Place this file inside your Python3 installation directory and your problem will hopefully be solved.


python3 basically runs your python3.bat file, which in turn runs the python.exe from its folder and passes the arguments to it.

I hope this solves your problem.

2 of 8
6

You should have python3 also in your path. You could use python3 to run your script:

python3 <your_script>

But to answer your question, you could use alias and update it as python.

$ python --version    
Python 2.7.6
$ alias python=python3
$ python --version    
Python 3.6.4
🌐
Glarity
askai.glarity.app › search › How-to-Set-the-Default-Python-Version-Using-the-Python-Launcher-on-Windows
How to Set the Default Python Version Using the Python Launcher on Windows - Ask and Answer - Glarity
- `%LOCALAPPDATA%\Programs\Pyt... applies to both console and windowed scripts.[7] 4. **Test it**: Open a new Command Prompt and type `py --version`. It should show your specified version....
🌐
Python
docs.python.org › 3 › using › windows.html
4. Using Python on Windows — Python 3.15.2 documentation
To select a particular version, add a -Version 3.x.y. The output directory may be changed from ., and the package will be installed into a subdirectory. By default, the subdirectory is named the same as the package, and without the -ExcludeVersion option this name will include the specific version installed.