In PowerShell, Get-Command python | fl * will tell you which Python executable it's finding and show you details about where it is.

  1. You can check Settings -> Apps and Features, or Control Panel -> Programs and Features. They will show you distinct versions of Python you installed, but that might not be enough if Python is installed as part of some other toolkit or program.
  2. If Python 2.7.11 is there, select it and click uninstall. If it's not there, see if you can tell what it's installed with, from the output of Get-Command earlier, and decide if you want to remove that.
  3. How PowerShell chooses what to run when you type a command is explained in help about_Command_Precedence, and is:
    1. Alias
    2. Function
    3. Cmdlet
    4. Native Windows commands

At the point of "Native Windows commands", it goes to the PATH environment variable, a semi-colon separated list of path names, which get searched in order, looking for a matching executable file.

You can see the folders with:

$Env:PATH -split ';'

And you can watch PowerShell identify what to run for 'python' with the command

Trace-Command –Name CommandDiscovery –Expression {get-command python} -PSHost

So, to make Python 2.7.13 the one to launch, you could:

  • make it the only Python version available.
  • move its folder to the front of the PATH list, ahead of any other version. See: What are path and other environment variables, and how can I set or use them - question on SuperUser.com
  • make a batch file to launch it called python.bat in a folder in the PATH ahead of other versions.
  • make an alias (in your PS Profile) named python to launch the one you want (New-Alias -name python -Value C:\Python27\python.exe , etc).
Answer from TessellatingHeckler on Stack Overflow
Top answer
1 of 3
34

In PowerShell, Get-Command python | fl * will tell you which Python executable it's finding and show you details about where it is.

  1. You can check Settings -> Apps and Features, or Control Panel -> Programs and Features. They will show you distinct versions of Python you installed, but that might not be enough if Python is installed as part of some other toolkit or program.
  2. If Python 2.7.11 is there, select it and click uninstall. If it's not there, see if you can tell what it's installed with, from the output of Get-Command earlier, and decide if you want to remove that.
  3. How PowerShell chooses what to run when you type a command is explained in help about_Command_Precedence, and is:
    1. Alias
    2. Function
    3. Cmdlet
    4. Native Windows commands

At the point of "Native Windows commands", it goes to the PATH environment variable, a semi-colon separated list of path names, which get searched in order, looking for a matching executable file.

You can see the folders with:

$Env:PATH -split ';'

And you can watch PowerShell identify what to run for 'python' with the command

Trace-Command –Name CommandDiscovery –Expression {get-command python} -PSHost

So, to make Python 2.7.13 the one to launch, you could:

  • make it the only Python version available.
  • move its folder to the front of the PATH list, ahead of any other version. See: What are path and other environment variables, and how can I set or use them - question on SuperUser.com
  • make a batch file to launch it called python.bat in a folder in the PATH ahead of other versions.
  • make an alias (in your PS Profile) named python to launch the one you want (New-Alias -name python -Value C:\Python27\python.exe , etc).
2 of 3
1

This was a question about python 2.7, but probably it will be useful to give an answer for the versions above 3.3 too:

Previously, multiple versions (also environments, also they are specific folders) of python on the same system was rare, and placing the only available python.exe directly in PATH was acceptable. Currently, multiple installed python versions will conflict and override each other if simply placed that way.
After 3.3 a python launcher was introduced which detects and activates one of the installed versions automatically. It is supposed to be placed in PATH instead of any python executable.

So in this modern situation, Get-Command python | fl * may give you nothing or nothing helpful.
And to run scripts or to get available versions, use launcher:

  • ensure you have it:
    try Get-Command py command from the PowerShell. If launcher is missing, it can be installed with the official installer. There is a separate checkbox for the launcher which is enabled by default.
  • if install is correct, command py --list-paths will give a summary on the installed versions, and supposed way to run scripts is not previous python main.py, but commands like py main.py or py -3.5 main.py. Run py --help for more info.

Additional confirmation that intended way changed.

Just to give an idea, launcher is not the only way to activate, this also can be done by a simple command.
For example, there is a version under D:\python_install\python.exe. But it's not in the PATH and python command correctly ends with not found error or opens Windows Store. An additional command in cmd or bat SET PATH=D:\python_install\;%PATH% or PowerShell $env:Path = "D:\python_install\;" + $env:Path temporarily activates that specific version, and python will work as previously during that specific run.

🌐
Microsoft Learn
learn.microsoft.com › en-us › answers › questions › 1332563 › windows-powershell-starts-old-python
Windows powershell starts old python - Microsoft Q&A
July 18, 2023 - Check File Associations: On Windows, the file association for .py files determines which version of Python is used when running scripts without specifying the version. Ensure that Python 3.11.4 is associated with .py files. You can check this in the "Default apps" settings or use the ftype command in PowerShell: PS C:\Users\XXX> ftype Python.File If it is not associated correctly, you can set it using the following command (replace C:\path\to\python3.11.4\python.exe with the actual path): PS C:\Users\XXX> ftype Python.File="C:\path\to\python3.11.4\python.exe" "%1" %* After making any changes, close and reopen your PowerShell window to apply the changes.
Discussions

switching from python 2 to python 3 in windows powershell
Anaconda scripts activate/deactivate don't work in powershell. Download replacement scripts from here: https://github.com/Liquidmantis/PSCondaEnvs and drop them into anaconda folder. Make powershell profile if you haven't done it already. Google how to do it. Add aliases to your profile and activate command. I have Python2 default, but everytime I start powershell Python3 is activated. Here's the relevant part of my profile: # Permanent Aliases Set-Alias python2 C:\Anaconda\python.exe Set-Alias py2 C:\Anaconda\python.exe Set-Alias pip2 C:\Anaconda\Scripts\pip.exe Set-Alias python3 C:\Anaconda\envs\py3\python.exe Set-Alias py3 C:\Anaconda\envs\py3\python.exe Set-Alias pip3 C:\Anaconda\envs\py3\Scripts\pip.exe # Make py3 conda env default in Powershell activate py3 More on reddit.com
🌐 r/learnpython
1
10
May 25, 2016
How can I set the default Python version that gets launched when typing python3 (On Windows 11)?
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\Ap... More on discuss.python.org
🌐 discuss.python.org
6
0
March 10, 2026
Why doesn't python 3.10.0 show up on PowerShell?
Greetings, all I am excited to learn python, and have enrolled in a course to this effect. However, I started encountering problems right off the mark. I installed Python 3.10.0 from the Python homepage (it defaulted to the amd64 installer for Windows) and followed all the steps - disable the ... More on discuss.python.org
🌐 discuss.python.org
6
0
October 12, 2021
Switching between versions of python installed from microsoft store
So I installed python 3.9 and 3.7 from the microsoft store because I need both versions for certain projects, and I am wondering if it is possible to switch between which version of python I want my system to use. More on learn.microsoft.com
🌐 learn.microsoft.com
1
0
February 8, 2021
🌐
Reddit
reddit.com › r/learnpython › switching from python 2 to python 3 in windows powershell
r/learnpython on Reddit: switching from python 2 to python 3 in windows powershell
May 25, 2016 -

correction: ment to say python 3 to python 2

Hi, I'm a beginner at python and currently progressing through learnpythonthehardway in which he uses python 2. Currently when I type python in powershell I'm in version 3.5.1 but I want to switch to version 2. I've tried http://stackoverflow.com/questions/13328258/powershell-python-change-version-used?answertab=active#tab-top
after i type $Env:Python =2 it says to use the command py and it should start up the 2.7 python but i get the error  
 
py : The term 'py' is not recognized as the name of a c spelling of the name, or if a path was included, verify At line:1 char:1

  • py

  • ~~

    • CategoryInfo : ObjectNotFound: (py:Strin

    • FullyQualifiedErrorId : CommandNotFoundException
        So im wondering if someone can either point out a mistake im making or if there is a simple way to switch over to python 2 other than removing all python files and reinstalling the 2.7 version.
        windows 10 Pro

🌐
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 - Set-up Different Python version in Windows Running PowerShell as Administrator in windows. Check the default version by using python --version Open the python directory, usually default install …
🌐
CircleCI
support.circleci.com › hc › en-us › articles › 16708605403035-How-to-Change-your-Python-Version-within-the-Windows-Executor
How to Change your Python Version within the Windows Executor – CircleCI Support Center
February 2, 2026 - ProblemIt is possible while we have a specific version of Python installed on our Windows Executor, your builds require something different instead. SolutionIf the version that you are looking for ...
Find elsewhere
🌐
GitHub
github.com › HealthCatalyst › PythonPowershellUtilities
GitHub - HealthCatalyst/PythonPowershellUtilities: The only powershell module you should ever need. · GitHub
A powershell module for installing python versions and managing python virtual environments - on windows. There are several good tools available for managing python installations and virtual environments for *nix. This module aims to take the best ideas from those tools and create a tool that feels native to windows.
Author   HealthCatalyst
🌐
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\Ap...
🌐
Python.org
discuss.python.org › python help
Why doesn't python 3.10.0 show up on PowerShell? - Python Help - Discussions on Python.org
October 12, 2021 - Greetings, all I am excited to learn python, and have enrolled in a course to this effect. However, I started encountering problems right off the mark. I installed Python 3.10.0 from the Python homepage (it defaulted to the amd64 installer for Windows) and followed all the steps - disable the ...
🌐
Medium
medium.com › mitb-for-all › creating-virtual-environments-with-different-python-versions-for-your-projects-2ba9972ae99e
PowerShell — Creating Virtual Environments with Different Python Versions for Your Projects | by Joshua Phuong Le | MITB For All | Medium
September 30, 2023 - In this article, I attempt to outline some steps I found useful to set up different virtual environments, with different Python versions and compatible library versions. Getting these out of the way first-thing whenever you start on a new project will ensure smoother transition from/to other colleagues.
🌐
BlueVPS
bluevps.com › blog › how to update the python version: step-by-step guide install python and upgrade python version
How to Update the Python Version - Blog - BlueVPS
September 25, 2023 - In this section, we will install Python or upgrade the current Python version with Chocolatey using the following steps: Run the Windows PowerShell as administrator on your system.
🌐
4Geeks
4geeks.com › en › how-to › how-to-update-python-version
How to Update Python to the Latest Version (2026)
July 16, 2025 - ... $ choco # Expected output: Chocolatey v1.2.0 Please run 'choco -?' or 'choco <command> -?' for help menu. Having Chocolatey installed in our System, upgrading Python is now as simple as typing: choco upgrade python -y
🌐
GitHub
github.com › pyenv-win › pyenv-win
GitHub - pyenv-win/pyenv-win: pyenv for Windows. pyenv is a simple python version management tool. It lets you easily switch between multiple versions of Python. It's simple, unobtrusive, and follows the UNIX tradition of single-purpose tools that do one thing well. · GitHub
pyenv is a simple python version management tool. It lets you easily switch between multiple versions of Python. It's simple, unobtrusive, and follows the UNIX tradition of single-purpose tools that do one thing well. Install pyenv-win in PowerShell.
Author   pyenv-win
🌐
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.
🌐
GitHub
github.com › 3Dmees › python-version-switcher
GitHub - 3Dmees/python-version-switcher: PowerShell script for easy Python version switching on Windows · GitHub
⚡ Fast switching - one command switches Python version for entire session · 🔧 Zero config - works immediately after installation · Download PythonSwitcher.ps1 from this repo or copy the code. ... # Open PowerShell with admin rights Set-ExecutionPolicy RemoteSigned -Scope CurrentUser # Add to profile $profilePath = $PROFILE if (!(Test-Path $profilePath)) { New-Item -Path $profilePath -ItemType File -Force } # Copy PythonSwitcher.ps1 content into profile file notepad $profilePath
Author   3Dmees
🌐
Psspy
psspy.org › psse-help-forum › question › 10719 › change-the-python-version-or-interpreter-on-psse-command-prompt
Change the python version or interpreter on pss/e command prompt - Python for PSSE help forum
March 15, 2026 - @rem run3437.bat @echo OFF Set PSSEVERSION=34 set PYVER=37 Set PYTHONCODE=%USERPROFILE%\Documents\Code\Python\ Set PYTHONHOME=c:\python%PYVER%\ SET PSSEROOT=%PROGRAMFILES(x86)%\PTI\PSSE%psseversion% SET PSSEPATH=%PSSEROOT%\PSSBIN\ set PSSPLTPATH=%PSSEROOT%\pssbin\ SET PSSPYPATH=%PSSEROOT%\PSSPY%PYVER%\ SET PATH=%PYTHONHOME%;%PYTHONHOME%SCRIPTs;%PSSEPATH%;%JAVAPATH%;%PATH% Set INCLUDE=%PSSEROOT%\PSSLIB;%INCLUDE% echo ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß echo %USERNAME% echo.
🌐
Microsoft Learn
learn.microsoft.com › en-us › answers › questions › 2133129 › how-to-upgrade-python-version-on-kudu-power-shell
How to Upgrade Python version on Kudu Power Shell on Azure Function Windows App - Microsoft Q&A
December 18, 2024 - Use the following PowerShell commands to download and install Python · Invoke-WebRequest -Uri "https://www.python.org/ftp/python/3.12.0/python-3.12.0-amd64.exe" -OutFile "python-3.12.0-amd64.exe" .\python-3.12.0-amd64.exe /quiet InstallAllUsers=1 PrependPath=1 ... Replace <library_name> with the actual names of the libraries you need to install. By following these steps, you should be able to upgrade your Python version, pip, and install the required libraries for your Azure Function.