[SOLVED]- ‘python’ is not recognized as an internal or external command

Many users have reported seeing – ‘python’ is not recognized as an internal or external command, operable program, or batch file error.

This error is seen when you open your command prompt to verify the successful installation of Python on your system.

What causes the error – ‘python’ is not recognized as an internal or external command, operable program, or batch file?

To access any files on your system, you should know the path to that file. The path is nothing but the location where the file is stored within the system.

When we execute the command python in the command prompt, we are calling the python.exe file from the location C:\Users\<username>

An error shows up since the system doesn’t find the python.exe file in the C:\Users\<username> folder.

Now that we have understood what is causing the issue, let us discuss various ways to fix it.

Fix 1: Specify the complete path to the Python file.

By default, Python is installed in the following directory:

C:\Users\%username%\AppData\Local\Programs\Python\Python<version number>

For example,


If you are not sure where Python is installed, follow the below steps:

1. Click on the search bar and type python.

2. Click on the top-most result.

3. From the right-hand side, click on Open file location.


locate the python interpreter


4. In the appearing window, right-click on the Python shortcut and choose the Open File location.


Right-click on Python file and choose Open File location


5. In the appearing window, locate the Python application file.

6. Copy this location.


location to the python file


7. Open Command Prompt, paste the copied location, and append \python as shown.


Python location

NOTE: If you see an error stating, “The system cannot find the path specified,” that is because the directory Appdata is hidden. Ensure you can view the hidden files and then run the command. Refer to this link to learn how to view the hidden files in Windows.

Entering the complete file path every single time is cumbersome. To avoid that, check the next fix.

Fix 2: Add Python to PATH variable manually.

Providing the complete path of the file every single time is annoying. To avoid that, we can make use of the PATH environment variable.

Generally, when you enter an application name in the command prompt, it looks for the application in the current directory. If it doesn’t find any matches, it looks for that application or program in all the locations mentioned in the PATH environment variable. If it finds the path to the required application or program, it will run that program.

To add the Python path to the PATH variable, follow the below steps-

1. Open the Run Dialog using Windows+R.

2. Type the below command and press Enter.

rundll32.exe sysdm.cpl,EditEnvironmentVariables


run command to open env variables

3. The Environment Variables window opens. Click on the Path variable as shown below.

4. Click on the Edit button.



Edit path and press on OK


5. In the appearing window, click on the New button.

6. Add an entry for the location of the Python file. If you are not sure of the location, refer to fix 1.

7. After adding the path, click on the OK button.



8. Close and re-open the command prompt for this change to take effect.

If you don’t see the changes, restart the system.

Now, open the command prompt and execute the ‘python’ command. 

Check if the error is solved.

Fix 3: Modify the Setup to Update the PATH variable from Installer.

In Python versions 3.6 and beyond, during the installation itself, you see an option to Add Python to PATH. If you haven’t checked this option for some reason during your first installation, you can still modify the installation using the Python installer. To do so, follow the below steps.

1. Open the Run window using Windows+R.

2. Type appwiz.cpl and press Enter.


3. In the opening window, locate the installer file for the version of Python you are running.

If you are not sure which python version you are using, check How to check the Python version?

4. Right-click on the Installer file and choose Change.



3. In the appearing window, select Modify.



4. In the appearing window, click on the Next button.

5. In the Advanced Options window, tick the Add Python to environment variables checkbox.

6. Click Install.



This will update the PATH environment variable.

7. Open the command prompt and enter the ‘python’ command. You shouldn’t see the error anymore.


In this article, we have discussed the causes of the ‘python’ not recognized as an internal or external command, operable program or batch file error, and we’ve also discussed ways to fix this issue. We hope this article has been informative. Thanks for reading.


If you enjoyed reading, share this article.

Anusha Pai is a Software Engineer having a long experience in the IT industry and having a passion to write. She has a keen interest in writing Python Errorfixes, Solutions, and Tutorials.

Leave a Comment