‘python’ is not recognized as an internal or external command, operable program or batch file.

The ‘python’ is not recognized as an internal or external command, operable program or batch file. error is encountered in the command prompt of Windows after you install Python on the windows machine. The error is raised when Python executable file path is not added in an environment variable. 

Since the problem is at execution, windows will not let you execute any Python code, even on the command prompt, and throws an error Python is not recognized as an internal or external command.

So what does this error mean, and why does it appear in the first place? Well, whenever you run any python code on your computer, the installed Python library is the one that will compile and execute the code. If you run the code in the same path where the Python executable is located, your code executes properly.

If you run it in any other path, then windows won’t know how to execute your code, and this can be resolved by adding Python executable in an environment variable.

Adding Python to the Windows PATH Environment Variable

Let’s go step by step process to add python to path windows 10 environment variable.

Step 1: Assuming that you have already installed Python on your windows machine, as a first step, locate the folder path where you have installed the Python. Usually, it will be in the OS directory “C:\Program Files\Python3.x” or inside “C:\Users\{user_name}\AppData\Local\Programs\Python\Python3.x” it may vary if you have installed OS in a different drive or Python is installed in a different directory. Alternatively, take the help of windows search in locating the file.

Step 2: Once you locate the file, right-click again and choose “Properties.” Copy the full “Location” path.

Step 3: Right-click This PC, then go to Properties => Advanced system settings => Environment variables.

Add Python To Path Windows 10
'python' is not recognized as an internal or external command, operable program or batch file. 4

Step 4: You’ll see your variables here. Select the PATH variable and click the “Edit” button. In the window that appears when a path variable exists, select it ​and click Edit; otherwise, click New.

'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. 5

Step 5: Finally, paste the path you copied earlier in Step 1. If your system has many paths linked by semicolons, append the path by prefacing it with a semicolon. Click Ok to save.

Once you have completed all the steps, try running the Python program from your command prompt. You can run the ‘py’ or ‘python’ command, and you should not see any error hereafter. Remember to close all the command prompt windows and reopening them again after completing the above steps. 

If you are downloading and installing the latest version of Python 3.6+, then during the installation itself, the installer will prompt you to automatically add the Python to system PATH.  

Adding Python To The Windows Path Environment Variable
'python' is not recognized as an internal or external command, operable program or batch file. 6

Leave a Reply

Your email address will not be published.

Sign Up for Our Newsletters

Get notified of the best deals on our WordPress themes.

You May Also Like
Python String Rstrip()

Python String rstrip()

Table of Contents Hide rstrip() Syntaxrstrip() Parametersrstrip() Return Value Example 1: Working of rstrip() Example 2 – How to use rstrip() method in real world? The Python String rstrip() method…
View Post
Python List Count()

Python List count()

Table of Contents Hide Syntax of List count() count() ParametersReturn Value from List count()Example 1: Use of count()Example 2: Count Tuple and List Elements Inside List Python List count() is a built-in…
View Post
Python Callable()

Python callable()

Table of Contents Hide callable() Syntax callable() Parameterscallable() Return ValueExample 1: How does callable() works?Example 2: When an Object is callable Example 3: When an Object is NOT callable  The callable() function in…
View Post
Importerror No Module Named Pandas

ImportError: No module named Pandas

In Python, if you try to import pandas without installing the module using pip, you will get ImportError: no module named pandas error.  In this tutorial, let’s look at installing…
View Post
Python String Ljust()

Python String ljust()

Table of Contents Hide ljust() Syntaxljust() Parameters ljust() Return valueExample 1 : Python program to left justify a stringExample 2: ljust() Method With * fillcharExample 3: Returns original string if the…
View Post