How to Fix Python Is Not Recognized as an Internal or External Command Error in Python

Manav Narula Feb 02, 2024
How to Fix Python Is Not Recognized as an Internal or External Command Error in Python

This tutorial will discuss the 'python' is not recognized as an internal or external command, operable program or batch file error in Python.

We can run the Python command and its scripts using the command prompt. For this, we use the python command in the command prompt. However, if we do not have set the path variables for Python properly, we get this error.

We will now discuss some quick fixes to solve this error.

The first method is to use py instead of python in the command prompt.

The main solution for this error involves adding the path variable to the windows environment variables. For this, we need to navigate to the System Settings in the Control Panel and go to Advanced System Settings. Here, we get the option to navigate to environment variables and add the path for the folder where Python is installed, and the python.exe binary executable is present.

Another way to ensure that this error never occurs is by checking the Add Python to environment variables option while installing Python. This will add the path variable automatically after installing.

add python to environment variables option in Python setup

Author: Manav Narula
Manav Narula avatar Manav Narula avatar

Manav is a IT Professional who has a lot of experience as a core developer in many live projects. He is an avid learner who enjoys learning new things and sharing his findings whenever possible.

LinkedIn