'python' is not recognized as an internal or external command
'python' is not recognized as an internal or external command,
operable program or batch file. When this error happens while typing python
in the Windows terminal (or command prompt), then you first need to ensure that Python is installed. For this you can press or click the Start button (the one with the Windows logo) and then type "python" (without quotes). On Windows 8, look for the search button at the top-right corner of the screen.
If you don't see something similar to the previous image, then you don't have Python installed. Download the latest version from https://python.org and when running the installer make sure to check the "Add Python 3.x to PATH" option. But if you do have Python installed, and nevertheless the python
command is not working in the terminal, then keep reading.
The first step is to locate the folder where Python is installed. Just right-click the Python application you found in the previous step and press "Open file location", as shown in the image:
Windows will open the file explorer in the folder where the Python shortcuts lie:
Again, right-click the "Python 3.x (64-bit)" (or similar, the "64-bit" might not appear) shortcut and press "Open file location":
You will be redirected to the Python installation folder:
Now we need to copy the path of that folder. Click the explorer's address bar (as indicated by the red arrow in the previous image) so the folder path is revealed as plain text.
Copy the folder path since we will use it afterwards.
Next, press or click again the Start button, but this time type in "variab" (without quotes).
Click on "Edit environment variables for your account". The following window will be shown:
In the first list, look for the "Path" variable, select it, and then press the Edit... button, as stated in the image. The following popup will appear:
Just ignore the items that are already there. You will probably have just a few items, or even an empty list. Press the New button, which will let you type in a new item. Paste the Python installation path (for example, C:\Python39
) you have copied in the previous step. Then press New again and add the \Scripts
folder to the Python installation path, like this:
Click OK in both dialog boxes. Open a new terminal or command prompt, and write python
. Now you will see:
Voilรก!