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:
| Situation | What you see | Fix |
|---|---|---|
| Python not installed | py --version also fails | Install it (fix 1) |
Installed, folder not on PATH | py --version works, python --version fails | Use py, or repair PATH (fix 3) |
| Store shortcut answering | Typing python opens the Microsoft Store | Switch 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 --versionThe 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
pythoncommand. You can keep usingpyfor everything, or continue to fix 2 and fix 3 to getpythonworking 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 -AllIf 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.14Close and reopen PowerShell, then run:
python --versionThe 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
pycommand launches your default interpreter, whilepymanagerdisplays 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 thepycommand.
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 with | Alias state to aim for |
|---|---|
| python.org installer with the PATH option | Store entries Off, so the real python is found |
| Python install manager | "Python (default)" On, refreshed by toggling it |
| Nothing yet | Either; 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.
- Refresh install manager commands. The Python documentation says that when an installed package's command is missing, you should run:
py install --refresh-
Remove competing installs. If
pythondoes not match whatpylaunches, the documentation says to click Start, open "Installed apps", look for any existing Python runtimes, and either remove them or choose Modify and disable thePATHoptions. -
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. -
Confirm the WindowsApps entry is still there. If someone removed
%UserProfile%\AppData\Local\Microsoft\WindowsAppsfromPATH, 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 --versionIf pip is missing, bootstrap it:
py -m ensurepip --default-pipTo upgrade it:
py -m pip install --upgrade pipThe 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 runtimeThe 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 --versionThe 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
| Symptom | Likely cause | What to do |
|---|---|---|
python opens the Microsoft Store | Store shortcut is first | Fix 2 |
py is not recognized | Microsoft Store build or no install | Install from python.org or the install manager (fix 1) |
py says "can't open file" | Legacy launcher has priority | Uninstall "Python launcher" under Installed apps |
python and py start different versions | Several installs, PATH points at an older one | Remove old runtimes or disable their PATH option |
| Package command missing after install | Missing generated executable | py install --refresh or use python -m |
| Double-clicking a script opens a new window | Operating system limitation | Run py script.py |
| Path with backslashes breaks a script | Python escape characters | Use 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 --versionin a fresh terminal. - If it fails, install Python with winget, the install manager or python.org.
- Run
Get-Command python -Alland 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 piporpython -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, thepython --versioncheck, the Store alias explanation, and thatpyis 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_Precedencearticle on 2026-11-20. ConfirmedGet-Command <name> -Alllists hidden commands and that PowerShell runs executables only from$Env:PATHor by full path. The documented output there is forGet-Dateandwhere, 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-pipandpy -m pip install --upgrade pip. The page documents sample output only forpy --version(aboutPython 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
- Python documentation, Using Python on Windows: https://docs.python.org/3/using/windows.html
- Microsoft Learn, Python on Windows for beginners: https://learn.microsoft.com/en-us/windows/python/beginners
- Microsoft Learn, about_Command_Precedence (PowerShell): https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_command_precedence
- Python Packaging User Guide, Installing packages: https://packaging.python.org/en/latest/tutorials/installing-packages/
Comments
Questions and tips are welcome. Comments are checked by the EpiFive team before they appear; please do not share passwords, phone numbers or other private details.