The error “Python was not found; run without arguments to install from the Microsoft Store” is one of the most common configuration failures. I’ve been through this, and I believe you are in the same situation. It occurs mostly due to a precedence conflict between the manual Python installation and the native Windows App Execution Aliases.
Here, I will explain and we will technically analyze why Windows intercepts your command and how to reconfigure the system to prioritize your developer installation.
1. App Execution Aliases
Windows 10 and 11 introduced a feature called App Execution Aliases. Microsoft’s goal was to make life easier for casual users: if you type python and don’t have it installed, the system automatically redirects you to the Microsoft Store.
To make this work, Windows creates ghost files of 0KB named python.exe and python3.exe in the folder:
%USERPROFILE%\AppData\Local\Microsoft\WindowsApps
But there is a conflict: this folder is usually at the top of the PATH environment variable. Thus, even if you install Python from the official website, Windows finds the store shortcut first and displays the error message, blocking the execution of your real compiler.
2. Disable Execution Aliases
This is a solution I highly recommend. It removes the operating system’s interference over the python command.
- Access Windows Settings (Win + I).
- Go to Apps > Apps & Features (or Advanced app settings in Windows 11).
- Click on App execution aliases.
- Locate the items in the list:
- App Installer (python.exe)
- App Installer (python3.exe)
- Toggle the switch to Off for both.
This removes the 0 KB files from the WindowsApps folder. Now, when you type python, the system will be forced to look in other folders in your PATH until it finds your real installation.
3. Hierarchy Adjustment in Environment Variables
If, after the previous step, the terminal informs you that the command was not found (without mentioning the Microsoft Store), you need to ensure that Python is correctly registered in the system and with the right priority.
- Press
Win + R, typesysdm.cpl, and hit Enter. - Go to the Advanced tab and click Environment Variables.
- Under User Variables, select Path and click Edit.
- Verify if the following paths are present:
...\Python3x\(Main executable folder)...\Python3x\Scripts\(Folder for pip and other tools)
- Critical Action: Select these paths and use the Move Up button until they are at the top of the list.
- Click OK and restart the terminal (CMD does not update environment variables in real-time).
4. Python Launcher
A professional and often ignored alternative is the use of the Python Launcher for Windows, which is installed automatically with versions from python.org.
The py.exe executable is located in a system folder (C:\Windows\) which generally has priority over Microsoft Store aliases.
- Instead of
python script.py, usepy script.py. - To check the version:
py --version. - If you have multiple versions of Python (3.9, 3.11, 3.12), you can choose which one to use with
py -3.11 script.py.
5. Avoid the Microsoft Store version
Although the Microsoft Store offers a quick installation, it has limitations that affect developers:
- Isolated Environment: The Store Python runs in a sandbox, which can cause permission issues when accessing system folders or hardware devices.
- Restricted PATH: It doesn’t always integrate command-line tools (pip, venv) in a conventional way.
Installation via python.org or managers like Conda or pyenv-win is always the correct choice.
Conclusion
The “Python was not found” error is an example of how features designed for the end user can hinder a developer’s workflow. By disabling Execution Aliases and ensuring precedence in the PATH, you regain control of the environment and ensure that the terminal responds exactly to the compiler you installed.
Final Tip: After making the changes, use the where python command in CMD. It will list all the paths where Windows finds an executable named python. The first one on the list will be the one executed by default.
FAQ
Why does Windows keep opening the Microsoft Store even after I manually installed Python?
This occurs due to a search precedence in the system. Windows keeps the Microsoft Store shortcuts in a folder that, by default, is listed at the top of the PATH environment variable. When you type python, the system scans this list from top to bottom. Since it finds the Store shortcut first, it executes it. The definitive solution is to disable Execution Aliases or move your manual installation paths to the top of the list in the PATH.
Is it recommended to uninstall the Microsoft Store version of Python if I already have the official version?
Certainly, leaving both versions can cause serious library conflicts and ambiguity in the terminal. For developers, the python.org version is the technically correct choice.