This Windows error appears when Python isn’t on your PATH or a system alias hijacks the command. Here’s how to install correctly, fix PATH, and verify.
Quick fix: Reinstall from python.org and check “Add python.exe to PATH” during setup.
Then open a new terminal and run python --version.
-
1
Locate your Python install
Common paths after a user install:
%AppData%\Programs\Python\Python311
%AppData%\Programs\Python\Python311\ScriptsIf you can’t find Python, see this quick guide.
Finding Python installation folders -
2
Open Environment Variables
Search “Environment Variables” in Windows Search and open System Properties.
-
3
Edit the Path variable
System Properties → Environment Variables → under your account, select “Path” → Edit.
-
4
Add Python and Scripts paths
Click “New” and add both folders you noted in Step 1. Example:
%AppData%\Programs\Python\Python311
%AppData%\Programs\Python\Python311\Scripts
-
5
Verify in a new terminal
Open a new terminal or PowerShell and run:
python --version
pip --version
py -VIf the first two still fail but
py -Vworks, trypy -m pip install <pkg>. -
6
Optional: disable Windows “App execution alias”
Windows 10/11 can hijack
pythonvia an alias:- Settings → Apps → Advanced app settings → App execution aliases
- Turn off the aliases for Python (App Installer)
Tip: If you installed for “All Users,” paths are usually under C:\Program Files\Python311\.
Add both Python311 and Python311\Scripts.