Just downloaded Python and trying to run it in the Command Prompt, but you see this annoying error? ‘python’ is not recognized like this below
'python' is not recognized as an internal or external command, operable program or batch file.
Yeah, it’s super frustrating. But don’t worry, this usually means one thing: your computer doesn’t know where Python is installed. Let’s break down what that means and how to fix it.
Table of Contents
What This Error Actually Means
When you type python
into Command Prompt or PowerShell, your system is supposed to find the Python program and run it. If it says “not recognized,” it means the computer literally can’t find the Python executable.
This usually happens when:
- Python isn’t installed properly
- The install folder isn’t added to something called the PATH environment variable
How to Check if Python Is Installed
Step 1: Open Command Prompt
Press Windows + R
, type cmd
, then hit Enter.
Step 2: Type python
or python3
Try running:
python --version
Or:
python3 --version
If neither of those work, Python is either not installed or not set up correctly.
Fixing the Problem
Option 1: Reinstall Python and Check the Box
The easiest fix is to reinstall Python and make sure you check the box that says:
“Add Python to PATH”
How to do it
- Go to python.org
- Download the latest version for Windows
- Run the installer
- Before you click “Install Now,” check the box at the bottom that says “Add Python to PATH”
- Then install it like normal
Once it’s installed, try running python
again in Command Prompt.
Option 2: Manually Add Python to PATH
If you already installed Python but didn’t check the box, you can still fix it.
Step 1: Find where Python is installed
It’s usually in a folder like:
C:\Users\YourName\AppData\Local\Programs\Python\Python311
Or:
C:\Python311
Copy that folder path.
Step 2: Add it to the PATH variable
- Open the Start Menu and search for “Environment Variables”
- Click on Edit the system environment variables
- In the System Properties window, click Environment Variables
- Under System variables, find the one called
Path
and click Edit - Click New and paste the folder path you copied
- Click OK on everything to save
Now reopen Command Prompt and type:
python --version
It should finally work.
Extra Tip: Try py
Instead of python
Sometimes Windows installs a launcher called py
, which might already work even if python
doesn’t. Try running:
py
or
py --version
If that works, Python is installed, but the PATH just isn’t set up for python
.
Final Thoughts
This error looks scary at first, but it’s just a setup issue. Either reinstall Python and check that PATH box, or manually add the folder to your environment variables. Once it’s fixed, you’ll be good to go for all your Python coding adventures.