The error message “Python 2/3/4 is not recognized as an internal or external command, operable program, or batch file” usually occurs in a Windows 11/10 environment when you try to run a Python script or execute a Python command in Command Prompt or PowerShell. but the system is unable to find the Python interpreter. This error can occur for several reasons:
- Python is not installed: If Python is not installed on your system or the installation is not done correctly, the system will not be able to find the Python executable.
- Python is not in the system’s PATH: The PATH environment variable is a list of directories that the system searches when trying to execute a command. If the directory where Python is installed is not included in the PATH, you will get this error.
- Typo in command: A simple typographical error in the command you are trying to execute can also trigger this error. Make sure you typed the command correctly.
Through this tutorial, you will learn how to set or add python path environment variables in Windows 11/10 to fix python 2/3/4 is not recognized as an internal or external command, operable program or batch file.
Python 2/3/4 is not recognized as an internal or external command windows 11/10
Steps to add/set Python 2/3/4 environment variables windows 11/10 to fix python is not recognized as an internal or external command, operable program, or batch file:
- Step 1 – Open Windows 11/10
- Step 2 – Edit Environment Setting
- Step 3 – Edit System Environment Variable Path
- Step 4 – Add Python to the PATH environment variable
- Step 5 – Restart Windows 11|10
- Step 6 – Test Python Version
Step 1 – Open Windows 11/10
First of all, Open the Start menu and search for “Environment Variables” and select “Edit the system environment variables.” like following:
Step 2 – Environment Setting
Then, In the System Properties window, click the “Environment Variables” button; as shown below picture:
Step 3 – Edit System Environment Variable Path
In the “Environment Variables” window, under the “System variables” section, scroll down and find the “Path” variable, then click “Edit.”; as shown below picture:
Step 4 – Add Python to the PATH environment variable
In the “Edit Environment Variable” window, click “New” and add the path to your Python installation. By default, Python is usually installed in the “C:\Program Files\Python” directory. You should find a folder with the Python version you installed. Add the path to the “Scripts” directory inside this folder. For example, it might look like “C:\Program Files\Python\Python3X\Scripts” (where X is the Python version); as shown below picture:
Click “OK” to close the “Edit environment variable” dialog, “OK” again to close the “Environment Variables” dialog, and one last “OK” to close the “System Properties” dialog.
Step 5 – Restart Windows 11|10
Restart any open command prompt windows, or open a new one. Now, you should be able to run Python commands from any directory within the command prompt.
Step 6 – Test Python Version
After adding Python to the PATH, open a new command prompt or PowerShell window and try running Python again. The “python is not recognized” error should be resolved.
If the output displays the Python version, then Python has been successfully added to the PATH variable.
That’s it, you should be able to fix the “python is not recognized as an internal or external command” error on Windows 10/11 and use Python from the command line.