Fix Python3 is Not Recognized in Windows Path
In this article
To fix the "python3 is not recognized" error, you must add the Python installation folder and the Scripts folder to your Windows System Environment Variables. This tells Windows exactly where the Python executable is located so you can run it from any Command Prompt or PowerShell window.
What You'll Need
- An existing installation of Python on your Windows PC.
- Administrator privileges to edit system environment variables.
- The file path to where Python was installed (usually in the AppData folder for single-user installs).
Step-by-Step
- Find your Python installation path: Open the Start menu, type "Python", right-click the Python app, and select "Open file location". If this takes you to a shortcut in the Start Menu folder, right-click the shortcut again and select "Open file location" until you are in the folder containing
python.exe. Copy the full path from the address bar at the top of the File Explorer window. - Open Environment Variables: Press the Windows Key, type "env", and select "Edit the system environment variables". (Note: Menu labels may vary slightly depending on your version of Windows).
- Access System Variables: In the System Properties window that appears, click the "Environment Variables..." button near the bottom right.
- Edit the Path variable: Under the "System variables" section (the bottom half of the window), scroll down to find the variable named "Path". Select it and click "Edit...".
- Add the Python executable path: Click the "New" button on the right side of the window. Paste the path you copied in Step 1 (e.g.,
C:\Users\YourName\AppData\Local\Programs\Python\Python312). - Add the Scripts path: Click "New" again. Paste the same path as before, but add
\Scriptsto the end of it (e.g.,C:\Users\YourName\AppData\Local\Programs\Python\Python312\Scripts). This ensures thatpipand other installed packages work. - Save and Exit: Click "OK" on the Edit Environment Variable window, click "OK" on the Environment Variables window, and click "OK" on the System Properties window.
- Restart your terminal: Close any open Command Prompt or PowerShell windows. Open a new one for the changes to take effect.
- Verify the fix: Type
python --versionorpython3 --versionand press Enter. You should now see the installed version of Python instead of an error message.
Common Mistakes
- Forgetting to restart the terminal: Environment variable changes do not apply to windows that are already open. You must close and reopen the Command Prompt.
- Adding the wrong folder: Users often add the folder containing the shortcut rather than the folder containing the actual
python.exefile. - Missing the Scripts folder: If you only add the main Python folder,
pythonwill work, butpip(the package manager) will still return a "not recognized" error. - Typing the path manually: Manually typing paths often leads to typos or missing backslashes. Always copy and paste from the File Explorer address bar.
Tips
- The Installer Shortcut: If you are reinstalling Python, check the box that says "Add Python to PATH" on the very first screen of the installer to avoid doing this manually.
- Use the Python Launcher: On Windows, the command
pyis often installed by default as a launcher. Try typingpy --version; if it works, you can usepyinstead ofpython3. - Check for Multiple Versions: If you have multiple versions of Python installed, the one listed highest in the Path list is the one Windows will execute first.
Troubleshooting
If you have followed the steps and still see the error, try these solutions in order:
- Check for typos: Re-open the Path editor and ensure there are no extra spaces or missing backslashes in the paths you added.
- Check User vs. System Variables: If you do not have administrator rights, try adding the paths to the "User variables" section (the top half of the Environment Variables window) instead of the "System variables" section.
- Disable App Execution Aliases: Windows 10 and 11 have "App execution aliases" that sometimes redirect
python.exeto the Microsoft Store. Go to Settings > Apps > Advanced app settings > App execution aliases. Find "Python" and "Python3" and toggle them to "Off". - Reinstall Python: If the
python.exefile is missing from the folder you found, the installation may be corrupt. Download the official installer from python.org and choose the "Repair" option.
Frequently Asked Questions
What is the difference between python and python3 commands?
On Windows, the installer typically uses python. On Linux and macOS, python often refers to the old Python 2, while python3 refers to the current version. Adding the path allows Windows to recognize whichever command your specific installation supports.
Will adding Python to the path slow down my computer?
No. The Path variable is simply a list of folders Windows searches through when you type a command. Adding two folders for Python has no noticeable impact on system performance.
Do I need to do this every time I restart my PC?
No. Environment variables are permanent settings stored in the Windows Registry. Once you save them, they persist through restarts.
Why is pip still not recognized after I fixed python?
This happens if you added the main Python folder but forgot to add the \Scripts folder. Pip is located in the Scripts subfolder, so that specific path must be added to the Environment Variables separately.
Can I use a different folder for Python?
Yes. You can install Python in any folder you have permission to write to. As long as you add that specific folder path to the Environment Variables, it will work regardless of the location.