Python Not Found Error on Windows
The common error message "Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases" occurs when Windows cannot locate your Python installation or when Windows App Execution Aliases are interfering with command line execution.
Root Cause
This issue typically happens when:
- Python is not installed on your system
- Python is installed but not added to the system PATH
- Windows App Execution Aliases are overriding your installed Python
- The Python installation was incomplete or corrupted
Solutions
1. Disable App Execution Aliases (Quick Fix)
IMPORTANT
This is often the most immediate solution for the specific error message mentioned.
- Open Windows Search (⊞ Win + S)
- Type "Manage App Execution Aliases" and select it
- Turn off both "App Installer" entries for Python
2. Verify and Add Python to System PATH
If Python is installed but not recognized:
Locate your Python installation directory (common locations):
C:\Users\[Username]\AppData\Local\Programs\Python\Python[Version]
C:\Program Files\Python[Version]
Add to System Environment Variables:
- Right-click Start → System → Advanced system settings
- Click "Environment Variables"
- Under "System variables", find and select "Path" → Edit
- Add these two paths (replace with your actual paths):
C:\Users\[Username]\AppData\Local\Programs\Python\Python311
C:\Users\[Username]\AppData\Local\Programs\Python\Python311\Scripts
TIP
Add these to System variables rather than User variables for system-wide access.
3. Reinstall Python Correctly
If Python isn't installed or was installed incorrectly:
- Download Python from the official website: python.org
- During installation: Check "Add python.exe to PATH"
- Optional but recommended: Choose "Customize installation" and ensure all components including pip are selected
4. Alternative Commands to Try
If the above solutions don't work immediately, try these command alternatives:
# Use the Python launcher with explicit version
py -3 --version
# Or try python3 instead of python
python3 --version
# For pip operations with the Python launcher
py -3 -m pip install --upgrade pip
5. Verify Installation and Environment
Check what Python installations Windows can detect:
# List available Python installations
where python
# List available Python launcher installations
where py
Advanced Troubleshooting
For IDE Users (VS Code, PyCharm)
If you're using an IDE and encountering this issue:
- Check which Python interpreter your IDE is using
- Copy that path and add it to your system PATH variable
- Restart your IDE after making changes
For Anaconda/Miniconda Users
Anaconda users might need to:
- Ensure Conda environment is activated
- Use
python
instead ofpython3
in commands - Check that Anaconda paths are in your system PATH
Prevention
To avoid this issue in the future:
- Always check "Add Python to PATH" during installation
- Install Python to a standard location (not user-specific folders)
- Regularly update your Python installation
- Consider using virtual environments for project-specific dependencies
When All Else Fails
If you've tried all solutions and still encounter issues:
- Restart your computer - Environment variable changes often require a restart
- Check for multiple Python installations - Remove conflicting versions
- Use the Python Windows Store app - Though limited, it can work for basic needs
Manual Pip Installation (Last Resort)
If pip is missing entirely:
- Download get-pip.py: bootstrap.pypa.io/get-pip.py
- Run:
python get-pip.py
orpy -3 get-pip.py
- Verify with:
pip --version
By following these steps, you should resolve the "Python not found" error and be able to use Python and pip normally from the command line.