I want to alias python3 to python on windows. I have already removed the alias for the microsoft store as described in this answer. However python3 is still not a known alias. How to I fix this?

  • 1
    Have you tried using doskey and create a macro named python3 that will run Python.exe similar to the default macro py that exists
    – Ramhound
    Commented Aug 10, 2020 at 23:23
  • You have the alias built-in if you install Python 3 from the Windows Store (rather than using winget or the python.org installer).
    – Danra
    Commented Feb 28 at 21:19
  • @Danra But that's not an option if you already have an installation or don't want to use the Windows Store. Commented Mar 1 at 12:05
  • 1
    Sure. It's unfortunate the other installation venues don't provide the same convenience built-in.
    – Danra
    Commented Mar 4 at 5:28

5 Answers 5


I want to alias python3 to python on Windows.

You haven't mentioned what release of Python you are using (e.g. "vanilla" Python, Anaconda, SciPy, etc.), but if I am not misunderstanding, this likely shouldn't be necessary. For Windows versions of Python (i.e. not WSL), python3 is not typically a standard alias. That is, the Python 3.x executable is usually just python (python.exe).

Be aware that python.exe should be in a folder listed in your Windows Path if you want to access it as just python. You can find a refresher on editing Windows Path variables here.

If you meant the reverse (i.e. you want to run Python 3.x with python3), then there are at least a few possible approaches (each item below is a separate option):

  1. Make symbolic link called python3.exe to your preferred copy of Python 3.x with mklink:

    mklink "C:\path\to\symlink\python3.exe" "C:\path\to\Python3\python.exe"
  2. Copy the python.exe file in your preferred installation of Python 3.x and rename the copied executable python3.exe.

  3. If you aren't set on specifically using python3 and have the Python Launcher for Windows (py.exe) installed which comes with "vanilla" Python from python.org, you can use:

    # Use the "default" installation of Python 3.x, 
    # as detected by the Python Launcher for Windows.
    py 3


    # Use a specific version of Python 3.x if you have more
    # than one version installed, outside of a virtual environment.
    py 3.8
  4. Create a Windows batch file called python3.bat with the following information:

    ex. python3.bat

    C:\path\to\Python3\python.exe %*
  5. You can also alias Python Launcher for Windows (py.exe) calls in a similar manner in python3.bat e.g.:

    ex. python3.bat

    py 3 %*


    ex. python3.bat

    py 3.8 %*

With all the options above, any "python3" file you wish to access from the command line (i.e. any symbolic link, a renamed executable copy, py.exe or python3.bat) must be in a folder located in your Windows Path.


  • These options obviously do not include any option to "alias" python.exe at the command line (e.g. via doskey macros, as mentioned in the comments, or possibly via actual alias commands specific to a given terminal). It also ignores the possibility that some distributions of Python could (theoretically) already come with a python3 alias.

  • Creating a symbolic link with mklink on Windows may require administrative privileges on versions of Windows earlier than some early releases of Windows 10.

  • When creating a symbolic link, be certain to include the file extension (.exe). This is not optional if you want the link to work correctly.

  • It is likely best to leave any renamed executable copy (option 2) in the same folder as the original python.exe.


If you are using the Windows PowerShell and not the command prompt, you can use the following code:

Set-Alias -Name python3 -Value python

or use the following code:

Set-Alias -Name python3 -Value "C:\Python39\python.exe"

Note that this is a temporary Alias for the current session, to make it permanent; you have to copy the above command into an empty text file and name it Profile.ps1 file and copy it to one of the following folders:

if you are using PowerShell 7:

{My Documents Folder}/PowerShell

if you are using Windows PowerShell which comes by default in Windows 10:

{My Documents Folder}/WindowsPowerShell

or inside the installation folder of PowerShell, which can be figured out by:


If your python 3.x is already in your PATH and you've already deleted any previous python3 versions from your machine (and PATH), you just need to run:

mklink "C:\path\to\Python3\python3.exe" "C:\path\to\Python3\python.exe".

If you're running multiple versions of python3, you can set the symlink to whatever you want:

mklink "C:\path\to\Python3\pythonXYZ.exe" "C:\path\to\Python3\python.exe".

Restart cmd prompt and python3 --version or pythonXYZ --version will print your linked version

  • 2
    I use mklink python3.exe python.exe and its work for me Commented Feb 3, 2023 at 12:27

If you are still wondering how to do it, Here is one workaround!
Create a PowerShell file named python3.ps1 and inside that just type python and save it anywhere you like.
Copy that path and add that path to the Environment path. Now you are ready to go!
Just type python3 and it runs python.
you can also use the python command to use python.

  • For me this doesn't work unless I type python3.ps1, which defeats the whole purpose of it...
    – red-o-alf
    Commented Apr 23, 2022 at 21:38
  • Maybe you didn't add the script to the environment variable? Would you mind commenting on the output of the terminal when typing python3? Commented Apr 25, 2022 at 10:39
  • I added the path where the script is located to the environment variable, not the script itself... it doesn't make sense to add a file to a PATH variable, does it?
    – red-o-alf
    Commented May 6, 2022 at 18:20
  • Yes, you need to add path to the environment variable not the file itself. And it only works from powershell as far as I know. If you want to run the command from cmd, you need to add .bat file also. It may work after that. Commented May 8, 2022 at 1:37
  • it doesnt work. Commented Nov 22, 2022 at 11:47

For people ending up here while using powershell, this is another way to create symlinks.

Caveat: Requires Admin rights or group policy that allows this on normal mortal users

  • Open Admin / Link creation capable powershell terminal
  • Run
$venv=((get-command python).source | Get-ItemProperty).DirectoryName;New-Item -Path $venv -Name "python3.exe" -Value "$venv\python.exe" -ItemType SymbolicLink

If you work no a virtual environment, run this first:


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .