How-to & tips

Fix "python is not recognized" on Windows: PATH, Aliases and py

Python not found in Command Prompt or PowerShell? Check the Store alias, the py launcher and PATH in a fixed order, then confirm python and pip run.

By EpiFive Editorial TeamReviewed/updated 12 min readHow we check our guides
On this page

When Windows says that python is not recognized, one of three things is true: Python is not installed, Python is installed but its folder is not on PATH, or the built-in Microsoft Store shortcut is answering instead of the real program. Run py --version to find out which, then follow the matching fix below. Most cases take under five minutes and never need you to edit PATH by hand.

Who this is for and what you will have at the end

This guide is for anyone who typed python or pip in Command Prompt, PowerShell or Windows Terminal and got an error or a Microsoft Store window instead of a version number. It suits beginners installing Python for the first time and developers who have several versions installed and are not sure which one answers.

By the end you will know which of the three causes applies to your machine, have a working python --version and py --version, and have pip running through python -m pip. The steps follow the Python documentation for Windows and Microsoft Learn's Python pages as read on 2026-11-20.

How Windows finds python

When you type a command name without a folder, the shell searches the folders listed in the PATH environment variable. Microsoft's PowerShell documentation says PowerShell does not run executable commands unless they sit in a folder listed in $Env:PATH, or you give the full path. So "not recognized" means that no folder on PATH contains a python.exe the shell can use.

Three separate things can sit behind that message:

SituationWhat you seeFix
Python not installedpy --version also failsInstall it (fix 1)
Installed, folder not on PATHpy --version works, python --version failsUse py, or repair PATH (fix 3)
Store shortcut answeringTyping python opens the Microsoft StoreSwitch the alias off or install the real Python (fix 2)

Microsoft Learn explains the shortcut: Windows includes it to take new users to the latest Python package in the Microsoft Store. Running it with command-line arguments returns an error code to say that Python was not installed, so batch files and scripts do not open the Store by accident.

Step 1: Test the py command

Open a new PowerShell window and run:

py --version

The pip tutorial on packaging.python.org shows this command and says it prints something like Python 3.6.3; the number you see depends on what is installed.

  • A version number appears. Python is installed. The problem is only the python command. You can keep using py for everything, or continue to fix 2 and fix 3 to get python working too.
  • An error appears. Either Python is not installed, or you have the Microsoft Store build, which Microsoft Learn says does not include py. Go to fix 1.

If you see a message about "can't open file" when using py, the Python documentation says this usually means the legacy launcher is installed and has priority over the Python install manager. Its fix is to open Start, then Installed apps, search for "Python launcher" and uninstall it.

Step 2: See what the shell resolves

PowerShell can list every command that matches a name. The All parameter of Get-Command shows commands even if another one hides them, as Microsoft's command precedence article explains:

Get-Command python -All

If Python is installed and on PATH, you should see an Application entry whose Source is the path to a python.exe. If the only entry points into WindowsApps, that is the Store shortcut. The Python documentation says %UserProfile%\AppData\Local\Microsoft\WindowsApps is on PATH by default, after other user paths.

Command Prompt users can run where.exe python instead. Microsoft's article uses where.exe for exactly this kind of lookup and shows that it is an executable under C:\Windows\system32.

To read the whole search path, one folder per line:

$Env:PATH -split ';'

Look for a folder that contains python.exe, such as the bin folder of the install manager (default %LocalAppData%\Python\bin per the Python documentation) or the install directory of a python.org installer.

Fix 1: Install Python

Microsoft Learn's beginner page lists two routes. The first is winget, then a check:

winget install Python.Python.3.14

Close and reopen PowerShell, then run:

python --version

The second route is installing Python from the Microsoft Store, which Microsoft Learn says configures PATH automatically and updates itself. After it finishes, open PowerShell and run python --version.

The Python documentation for Windows recommends the Python install manager, a standalone tool that makes Python available as global commands. It can be installed from the Microsoft Store or from python.org/downloads. After installing it, the documentation says the python, py and pymanager commands should be available. The same page marks the traditional installer as deprecated since Python 3.14 and says it will not be produced for Python 3.16 or later.

Two details from that page save time:

  • The py command launches your default interpreter, while pymanager displays help.
  • When you first install a runtime with the install manager, you will likely be prompted to add a directory to PATH. The documentation says this is optional if you prefer the py command.

If you use a python.org installer, tick the option that adds Python to PATH. The Python documentation describes it as, for "Install Now", "the install directory will be added to your PATH". Microsoft Learn adds that with that option selected, the new python command takes priority over the Store shortcut.

Fix 2: Switch off the Store shortcut

If typing python opens the Microsoft Store even though you installed Python elsewhere, the shortcut is winning. Microsoft Learn gives the fix: open "Manage app execution aliases" from Start, find the "App Installer" Python entries, and switch them to Off. This disables the shortcuts without installing Python.

The Python documentation describes the opposite case for the install manager: if python gives a "command not found" error or opens the Store, click Start, open "Manage app execution aliases", and check that the aliases for "Python (default)" are enabled. If they already are, disable and re-enable them to refresh the command. The "Python (default windowed)" and "Python install manager" entries may also need refreshing.

These two instructions look contradictory but apply to different setups:

You installed Python withAlias state to aim for
python.org installer with the PATH optionStore entries Off, so the real python is found
Python install manager"Python (default)" On, refreshed by toggling it
Nothing yetEither; Off stops the Store opening, On sends you to install

After changing an alias, close the terminal and open a new one before testing.

Fix 3: Repair PATH

If py --version works but python --version does not, PATH is missing the folder that holds python.exe. The least error-prone repairs come from Python's own tooling.

  1. Refresh install manager commands. The Python documentation says that when an installed package's command is missing, you should run:
py install --refresh
  1. Remove competing installs. If python does not match what py launches, the documentation says to click Start, open "Installed apps", look for any existing Python runtimes, and either remove them or choose Modify and disable the PATH options.

  2. Check the Scripts folder too. The documentation notes that each runtime has a scripts directory, and that this "also need[s] to be added to PATH" if you want to call installed tools by name.

  3. Confirm the WindowsApps entry is still there. If someone removed %UserProfile%\AppData\Local\Microsoft\WindowsApps from PATH, the documentation says shortcuts will not be found.

If you do edit environment variables by hand, work on the user PATH, add the folder that contains python.exe rather than the file itself, and open a new terminal to test. Avoid setting PYTHONPATH globally while you are at it: Microsoft Learn says doing so is not recommended because any version of Python may use it instead of the one you intend.

Fix 4: Make pip work

A common follow-up is pip not being recognized even though python works. The Python documentation says the package may be available but missing the generated executable, and recommends the python -m pip form instead. The packaging.python.org tutorial gives the Windows commands:

py -m pip --version

If pip is missing, bootstrap it:

py -m ensurepip --default-pip

To upgrade it:

py -m pip install --upgrade pip

The tutorial notes that if ensurepip fails, you can download get-pip.py from the official bootstrap URL and run python get-pip.py, but it warns that this method does not coordinate with operating-system or package-manager managed Python installs. Prefer ensurepip first.

If pip installs a package but its command (for example a tool you installed) is not found afterward, run py install --refresh for the install manager, or activate your virtual environment with .venv\Scripts\activate if you created one. The Python documentation lists both for "command not found" cases.

When a plain pip install fails with a permissions problem, Microsoft Learn says a common cause is installing into a location you cannot modify, and the best solution is to create a virtual environment and install there.

Choose a version on purpose

If several versions are installed, the py launcher lets you pick one. The current install-manager section of the Python documentation shows:

py                    launch the default runtime
py -V:3.15 ...        launch a specific runtime (-V: must come first)
py list               list installed runtimes
py install 3.15t      install a runtime

The legacy launcher section documents the older forms py -3.7 (a specific version) and py --list (list installed versions). Which set you have depends on whether the legacy launcher or the install manager is in charge, so run py list or py --list and use whichever your machine accepts.

Verify it worked

Open a new terminal and run these three checks:

python --version
py --version
py -m pip --version

The first two should print Python followed by a version number. The third should print a pip version and the folder it belongs to. Then run Get-Command python -All again and confirm the first entry is the python.exe you expect, not a WindowsApps shortcut.

Troubleshooting

SymptomLikely causeWhat to do
python opens the Microsoft StoreStore shortcut is firstFix 2
py is not recognizedMicrosoft Store build or no installInstall from python.org or the install manager (fix 1)
py says "can't open file"Legacy launcher has priorityUninstall "Python launcher" under Installed apps
python and py start different versionsSeveral installs, PATH points at an older oneRemove old runtimes or disable their PATH option
Package command missing after installMissing generated executablepy install --refresh or use python -m
Double-clicking a script opens a new windowOperating system limitationRun py script.py
Path with backslashes breaks a scriptPython escape charactersUse a raw string, such as r"C:\Users\MyName\file.txt"

The Python documentation calls the new-window behavior "a known limitation of the operating system" and suggests py script.py or a batch file instead.

Checklist

  • Run py --version in a fresh terminal.
  • If it fails, install Python with winget, the install manager or python.org.
  • Run Get-Command python -All and check what answers.
  • Switch the Store alias off, or refresh the Python aliases if you use the install manager.
  • Remove duplicate runtimes you do not use.
  • Use py -m pip or python -m pip.
  • Open a new terminal after every change and re-run the three verify commands.

For more Windows fixes in the same style, see Wi-Fi not working on Windows 11.

What we checked

  • Opened the "Using Python on Windows" page on docs.python.org on 2026-11-20 (it identified itself as the CPython 3.15.2 guide). Confirmed the install manager is the recommended route, the traditional installer is deprecated since 3.14, the PATH prompt is optional with py, and the "Manage app execution aliases" troubleshooting steps.
  • Opened Microsoft Learn's "Python on Windows for beginners" (page dated 2026-09-14) on 2026-11-20. Confirmed the winget command winget install Python.Python.3.14, the python --version check, the Store alias explanation, and that py is not included in the Store build.
  • Cross-checked the alias advice: Microsoft Learn says to switch the "App Installer" Python entries Off to stop the Store opening, while the Python documentation says to make sure "Python (default)" is enabled for the install manager. We kept both and explained when each applies.
  • Opened the PowerShell 7.6 about_Command_Precedence article on 2026-11-20. Confirmed Get-Command <name> -All lists hidden commands and that PowerShell runs executables only from $Env:PATH or by full path. The documented output there is for Get-Date and where, not Python, so we show no Python output.
  • Opened the pip installation tutorial on packaging.python.org on 2026-11-20. Confirmed py -m pip --version, py -m ensurepip --default-pip and py -m pip install --upgrade pip. The page documents sample output only for py --version (about Python 3.6.3) and none for the pip commands.
  • Not tested on a live Windows machine; no commands were run. Steps follow the vendors' documentation as of 2026-11-20. We could not open the troubleshooting section of the install manager page's final section, and we did not confirm the exact text of the error message, so this guide does not quote it.

Last tested: 2026-11-20

References

Questions people ask

Why does typing python open the Microsoft Store?

Windows includes a shortcut named python that sends new users to the Python package in the Microsoft Store. Microsoft Learn says installing Python from python.org with the "add to PATH" option makes the real python command take priority over that shortcut. You can also switch the Python entries off under "Manage app execution aliases".

Do I need to add Python to PATH if I use the py command?

No. The Python documentation says the PATH prompt from the install manager is optional if you prefer to use the py command. py is the recommended command for choosing between several installed runtimes. You only need PATH entries if you want to type python or run installed scripts by name.

How do I run pip when pip is not recognized?

Run it through Python instead: py -m pip --version, or python -m pip --version. The Python documentation recommends the python -m pip form because a package can be present without its generated executable. If pip itself is missing, py -m ensurepip --default-pip installs it.

Is the py launcher included with the Microsoft Store version of Python?

Microsoft Learn says the py command is not included when you install Python from the Microsoft Store, and that the launcher works with Python installed from python.org. Newer Python documentation describes the Python install manager, which provides python, py and pymanager commands. Test with py --version to see what your machine has.

PythonWindows 11PowerShellPATHpippy launcher