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 error occurs because the user has not specified the full path of the Python distribution. In order for the command to be successful in the current state, the user would have needed to specify the full path of the Python distribution inside the command.
If you want to run Python commands without having to add Python’s full path with each command, you’ll need to add Python to the Windows Path manually. Doing this can be somewhat confusing if you haven’t done this before.
In an attempt to make things easier for you, we’ve created a step-by-step guide 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.
- 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.