Add Python to the PATH Environmental Variable (‘python’ is not recognized as an internal or external command)
python.exe, they get the following error message:
‘python’ is not recognized as an internal or external command
We’ll show you how to install Python, and fix this error. By adding Python to the PATH environmental variable.
Step 1: Download Python
First visit the official Python download page and download the latest release. At the time of this writing the latest versions are 2.7.3 and 3.3.0.
Install it by double clicking the Python installer setup file and follow the wizard along.
Step 2: Add Python to the PATH Environmental Variable
Next, let’s click on the Start Menu and right click My Computer. Click on Advanced System Settings.
Then click on Environment Variables. This is where we can add Python to the PATH environmental variable.
PATH variable and click Edit. You want to add Python to this PATH variable by adding ;C:\Python27 to the end of that string (or whatever the path to your Python installation is).
Save your changes!
So what exactly is happening here?
At the point when you type in python in a command brief, Windows will use the PATH environmental variable to get a list of directories to go looking for the python.exe document. Before you followed the steps here, it couldn’t find the python.exe record, henceforth the mistake.
Since the PATH variable is set, when you execute python via the Windows console, you’ll see a familiar programming brief.
Given the increasing popularity of Python, it’s understandable why a lot of users are trying to run Python commands from the Windows Command Prompt. But the problem with this is, if you don’t specify Python’s full path for each command in part, you’ll end up getting an error saying that “Python is not recognized as an internal or external command, operable program or batch file.“
What is causing the Python is not recognized as an internal or external command error?
This particular mistake occurs because the user has not specified the full path of the Python distribution. In request for the command to be successful in the present status, the user would have expected to specify the full path of the Python distribution inside the command.
On the off chance that you want to run Python commands without having to add Python’s full path with each command, you’ll have to add Python to the Windows Path manually. Doing this can be somewhat confusing on the off chance that you haven’t done this before.
In an attempt to make things easier for you, we’ve created a step-by-step control that will walk you through the process of adding the Python path to a Windows environment.
Adding a Python to the Windows PATH
In order for this procedure to be successful, you need to ensure that the Python distribution is correctly installed on your machine.
Update: The Windows installer of Python 3.3 (or above) includes an option that will automatically add python.exe to the system search path. Using this installation method will save you from performing the steps below. You can download the latest web installer version of Python from this link (here). You’ll then have to download and run the appropriate x86 or x64 Windows Executable installer, depending on your CPU architecture.
If you already installed Python on your machine, the steps below will show you how to add Python to the Windows path. Doing this successfully will allow you to run Python commands from a Command Prompt window without having to specify Python’s full path with each command. The following procedure is compatible with Windows 7, Windows 8 (8.1) and Windows 10.
PRO TIP: If the issue is with your computer or a laptop/not
- Press Windows key + Pause key to open the System Properties menu. Alternatively, you can right-click on Computer (This PC) in the Start menu and choose Properties.
- Inside the System Properties menu, click on the Advanced system settings link using the sidebar in the left-hand side.
- In the System Properties menu, go to the Advanced tab and click on the Environment Variables button (bottom-section of the screen).
- Once you get into the Environment Variables menu, select the Path entry in the System variables section and then click the Edit button.
- Next, click the New button and add Python’s path at the end of the list. Keep in mind that you can separate multiple paths by semicolons.
- Click Ok to save the changes, then try to run a Python command from Command Prompt. If the steps above were performed correctly you should have no issues inputting commands without specifying the full Python path.