Python 2|3|4 is not recognized as an internal and external command, operable program or batch file issue error happens when Python is not installed in your system or Python is installed but the variable path is not set or the executable file of Python is corrupted.
Through this tutorial, we will show you a few approaches to fix ‘python’ is not recognized as an internal or external command error, operable program or batch file error.
To fix this error, you can try the following approaches:
- Approach 1: Install Python
- Approach 2: Set Python to the PATH environment variable
- Approach 3: Uninstall and Reinstall Python
Approach 1: Install Python
First, verify whether Python is installed in your system or not. If installed then follow approach 2 or if not then read this post and install Python.
Approach 2: Set Python to the PATH environment variable
- 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.”
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.
python --verion
If the output displays the Python version, then Python has been successfully added to the PATH variable.
Approach 3: Uninstall and Reinstall Python
If you have Python installed in your system. But the python executable file has corrupted. For this, you will have to uninstall Python and reinstall it.
Conclusion
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.