If you’ve ever tried running a Python script and saw the error message: “Python is not recognized as an internal or external command”,
then you’ve run into one of the most common issues after installing Python on Windows — Python not being added to the PATH environment variable.
Don’t worry — it’s an easy fix! In this guide, we’ll walk you through how to add Python to PATH manually or automatically, and also show you how to verify it’s set up correctly so you can run Python from the Command Prompt (CMD) without any issues.
What Is PATH and Why Is It Important?
The PATH is a system environment variable in Windows that tells your computer where to find executables like python.exe or pip.
If Python isn’t added to PATH, Windows doesn’t know where to look for it — which is why you get the “not recognized” error when you try running python or pip commands.
Adding Python to the PATH lets you run Python commands from any directory in the Command Prompt or PowerShell, making development much smoother.
Option 1: Add Python to PATH During Installation (Recommended)
The easiest way to set this up is during the installation process.
When you install Python for the first time, make sure you check this box at the bottom of the setup window: Add Python to PATH
Then, click Install Now.
That’s it — Python will automatically be added to your system PATH, and you can start using it right away from CMD.
After installation, verify by opening Command Prompt and typing:
python --version
If it shows a version number like Python 3.14.0, you’re good to go!
Option 2: Manually Add Python to PATH in Windows 11
If you already installed Python but didn’t check the PATH box, you can still add it manually.
Here’s how:
Step 1: Find Your Python Installation Path
- Press Windows + S and type Python.
- Right-click on the Python app → choose Open file location.
- Right-click again on the Python shortcut → Open file location.
- Copy the path from the address bar.
It should look like:C:\Users\<YourUsername>\AppData\Local\Programs\Python\Python314\
Step 2: Open Environment Variables
- Right-click the Start button and select System.
- Click Advanced system settings on the right side.
- In the System Properties window, click Environment Variables.
Step 3: Edit the PATH Variable
- Under System Variables, find and select Path, then click Edit.
- Click New, and paste your Python installation path.
- Also add the Scripts folder path:
C:\Users\<YourUsername>\AppData\Local\Programs\Python\Python314\Scripts\ - Click OK on all windows to save changes.
Step 4: Verify Your Setup
Open Command Prompt and type:
python --version
and
pip --version
If both return version numbers, Python and pip are now correctly added to PATH.
Option 3: Temporarily Add Python to PATH (For One Session)
If you only need Python temporarily in a single CMD session, use this command:
set PATH=%PATH%;C:\Users\<YourUsername>\AppData\Local\Programs\Python\Python314\
This method is temporary — once you close CMD, the setting resets.
How to Check PATH Configuration
To confirm Python’s PATH setup:
echo %PATH%
This will print the list of directories. Check that your Python and Scripts paths are listed.
You can also test by typing:
where python
If the command shows a valid file path, Python is successfully recognized by Windows.
Bonus Tip: Add Python to PATH Using PowerShell
You can also add Python to PATH with one PowerShell command:
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\Users\<YourUsername>\AppData\Local\Programs\Python\Python314\", [EnvironmentVariableTarget]::Machine)
After running it, restart PowerShell or CMD to apply changes.
Wrapping Up
Adding Python to PATH in Windows 11 is a one-time setup that makes life much easier for developers. Once it’s done, you can open CMD or PowerShell anywhere on your system and run Python scripts instantly — no need to type long file paths again.
So, if you’ve been getting “Python not recognized” errors, just follow the steps above — and you’ll be back to coding in no time.