Fix: Python is not recognized as an internal or external command

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.

"Python is not recognized as an internal or external command, operable program or batch file."
“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.

Downloading the appropriate Python installation executable
Downloading the appropriate Python installation executable

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.

  1. 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.
    Press Windows key + Pause Key or right-click on This PC and choose Properties
    Press Windows key + Pause Key or right-click on This PC and choose Properties
  2. Inside the System Properties menu, click on the Advanced system settings link using the sidebar in the left-hand side.
    Advanced System settings
    Advanced System settings
  3. In the System Properties menu, go to the Advanced tab and click on the Environment Variables button (bottom-section of the screen).
    Click on Environment Variables in the Advanced tab
    Click on Environment Variables in the Advanced tab
  4. Once you get into the Environment Variables menu, select the Path entry in the System variables section and then click the Edit button.
    Select the PATH entry from the System Variables menu and click on Edit
    Select the PATH entry from the System Variables menu and click on Edit
  5. 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.
  6. 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.
ABOUT THE AUTHOR

Kevin Arrows


Kevin Arrows is a highly experienced and knowledgeable technology specialist with over a decade of industry experience. He holds a Microsoft Certified Technology Specialist (MCTS) certification and has a deep passion for staying up-to-date on the latest tech developments. Kevin has written extensively on a wide range of tech-related topics, showcasing his expertise and knowledge in areas such as software development, cybersecurity, and cloud computing. His contributions to the tech field have been widely recognized and respected by his peers, and he is highly regarded for his ability to explain complex technical concepts in a clear and concise manner.