"Python Is Not Recognized as an Internal or External Command": How to Fix It
On Windows, "'python' is not recognized as an internal or external command, operable program or batch file" (or "pip is not recognized") means Windows can't find Python on your PATH. How to check whether Python is installed, use the py launcher, add Python to PATH, turn off the Microsoft Store alias, and fix pip.
'python' is not recognized as an internal or external command,
operable program or batch file.
or in PowerShell:
python : The term 'python' is not recognized as the name of a cmdlet, function,
script file, or operable program.
Windows is telling you it looked for a program called python in every folder on your PATH and didn't find one. Either Python isn't installed, or it's installed but Windows doesn't know where. The same applies to pip is not recognized. (PATH and "command not found")
Step 1: Try the py launcher
The official Python installer for Windows includes a launcher called py that works even when PATH isn't set up:
py --version
py -m pip --version
If py works, Python is installed — you can use py instead of python, and py -m pip install requests instead of pip install requests. That's a perfectly good long-term habit.
Step 2: Install Python if it isn't there
Install the Python install manager from python.org and follow the current Windows setup guide; it manages runtimes through py and Windows execution aliases. If you're using an older, traditional installer instead, tick "Add python.exe to PATH" on its first screen. (What Is Python?)
After installing, close and reopen your terminal. Already-open windows don't see PATH changes.
Step 3: Add Python to PATH manually
If Python is installed but PATH wasn't set:
- Find where it lives. It's often
C:\Users\<you>\AppData\Local\Programs\Python\Python3XX\. - Open Start → search "Edit environment variables for your account".
- Select Path → Edit → New, and add two entries:
C:\Users\<you>\AppData\Local\Programs\Python\Python3XX\C:\Users\<you>\AppData\Local\Programs\Python\Python3XX\Scripts\
- Click OK, then open a new terminal.
The Scripts folder is where pip.exe and other tools live — that's why pip can fail even when python works.
Step 4: The Microsoft Store trap
Windows ships with "app execution aliases" so that typing python opens the Microsoft Store. If you installed Python from python.org, those aliases can get in the way — python opens the Store instead of running your Python.
For a traditional installation, disable conflicting App Installer / Microsoft Store aliases under Settings → Apps → Advanced app settings → App execution aliases. If you're using the new Python install manager, keep its Python (default) aliases enabled instead — it uses those aliases to launch your selected runtime.
Step 5: Check which Python you're getting
where.exe python
python --version
where.exe works in both PowerShell and Command Prompt; bare where is a PowerShell alias for Where-Object. If several Python executables are on PATH, the first one is normally selected; the install manager can additionally choose the runtime behind its alias.
On Mac and Linux
The equivalent is zsh: command not found: python. Modern macOS and many Linux distributions only provide python3, not python:
python3 --version
python3 -m pip --version
Use a virtual environment for projects and the python command will work inside it. (Python Virtual Environments)
The summary
- Windows can't find Python on your PATH.
- Try
pyfirst. Reinstall with "Add python.exe to PATH" ticked, or add it by hand. - Turn off the Microsoft Store aliases, and reopen your terminal after changes.
EasySpawn gives you a Linux server with Python ready to go and Claude Code to set up virtual environments and dependencies — no Windows PATH wrangling. See how it works or join the waitlist.
Related: Python ModuleNotFoundError · pip externally-managed-environment · What Is WSL? · requirements.txt
Keep reading
The grep Command: Search Files and Logs Like a Pro
grep searches text for lines that match a pattern — in files, whole folders, or the output of another command. The examples you'll actually use: case-insensitive search, recursive search, line numbers, context around matches, counting, excluding folders, regex, and grepping logs, plus ripgrep.
"You Have Divergent Branches" in git pull: What It Means and How to Fix It
"hint: You have divergent branches and need to specify how to reconcile them" means your local branch and the remote both have commits the other doesn't. What divergence is, the three options (merge, rebase, fast-forward only), which to pick, and how to set a default so git stops asking.