Facebook Pixel[Solved] The term 'python' is not recognized as the name of a cmdlet, function,..... | Blog | CodeWithHarry
[Solved] The term 'python' is not recognized as the name of a cmdlet, function,.....

[Solved] The term 'python' is not recognized as the name of a cmdlet, function,.....

"The most asked question I have ever encountered in my Python Training career from students is: "How do I solve for python is not..."

By CodeWithHarry

Updated: 5 April 2025

The most asked question I have ever encountered in my Python training career from students is: "How do I solve for python is not recognized as an internal or external command..." error on Windows in 2023?

It's an error that can stop even seasoned Pythonistas in their tracks and turn an exciting coding session into a frustrating ordeal. If the following error screen sounds familiar, you are not alone:

The term 'python' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ python
+ ~~~
    + CategoryInfo          : ObjectNotFound: (python:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Well, this is not a Python-specific issue but something related to the Path Variable. This issue occurs when you do not have Python added to your path in Windows.

One quick & dirty way to fix this is to reinstall Python (which works for even Linux and Mac users) from the official Python website with the below options enabled:

python installer image

This way Python will automatically be added to the path after installation but if you are looking for a solution to fix your existing Python installation, continue reading as I walk you through the exact steps.

This works for Windows 10, Windows 11, and previous versions of Windows like Windows 8, Windows 7, and Windows XP.

What do I need to do to fix this issue?

If you quickly want to fix this issue, you need to follow the steps below to add Python to your path variable.

Follow the steps below:

Step 1: Click on the search icon beside the windows icon and type "Environment Variables". Click on the "Edit the system environment variables" option.

edit the system environment windows search

Step 2: A System Properties window will open as shown below. Click on "Environment Variables".

system properties on windows

Step 3: Select Path by clicking it and then click on "Edit".

path variable on windows system properties

Step 4: In the Environment Variables window, click the "New" button under the "Path" section. This will create a new entry where you can paste the paths you'll need.

Add the path where Python is installed on your system. This typically looks like <location of Python installation>, where you replace this with the actual path (e.g., "C:\Users\iitia\AppData\Local\Programs\Python\Python38-32").

Add the location where Python scripts are stored, usually <Python location>/Scripts. Again, replace this with the actual path.

My python is installed at "C:\Users\iitia\AppData\Local\Programs\Python\Python38-32" so I pasted the following paths one by one after clicking new as shown below:

adding python to path on windows

If you see any other version of Python added to the path, make sure to remove it by selecting it and clicking delete.

Step 5: Well, this step is crucial as beginners tend to skip this one. Make sure (I repeat, make sure) you restart your terminal.

Now try to type Python in the terminal, and you should see a screen similar to the one below:

python on windows terminal

and you are done. The error is gone. Happy Coding!

Additional Notes:

  1. If you are a beginner and starting out your Python journey, I recommend uninstalling and reinstalling Python again to avoid confusion. This way you will be able to focus on the main task at hand i.e. learning Python.
  2. In earlier versions of Windows, this same error looked something like this: "Python is not recognized as an internal or external command, operable program or batch file"
  3. Editing the Path Variable is a critical system operation. Always double-check the paths you're adding or removing to ensure that you're not accidentally altering other important system settings.

Tags

pythonisnotrecognizederror