Learn how to resolve the common issue of “Python is not recognized as an internal or external command” on Windows 10 and 11 with this simple guide.
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.
First of all, Open the Start menu and search for “Environment Variables” and select “Edit the system environment variables.”
Then, In the System Properties window, click the “Environment Variables” button; as shown below picture:
In the “Environment Variables” window, under the “System variables” section, scroll down and find the “Path” variable, then click “Edit.”; as shown below picture:
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.
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.
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.
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.