Home//

How to Fix 'python' is not recognized as an internal or external command

How to Fix 'python' is not recognized as an internal or external command

Minh Vu

By Minh Vu

Updated Nov 04, 2023

There are 2 common cases where the 'python' is not recognized as an internal or external command error occurs on Windows:

  1. Python is not installed.
  2. Python is installed, but you have not added Python to the system's PATH.

I will show you how to fix this error by the step-by-step instructions below. Let's get started!

How to Fix 'python' is not recognized as an internal or external command

1. Install Python

For the first case (Python is not installed), you will need to Download and Install Python on your Windows computer first.

If you have already installed Python, keep reading.

2. Add Python to the system's PATH

For the second case, you need to add Python to the system's PATH.

Here are the steps:

  1. Press Windows key and search for Edit the system environment variables.
  2. Click Environment Variables.
  3. Under System variables, select Path and click Edit.
  4. Click New and add the path to the Python folder. It is usually located at C:\Users\{your-username}\AppData\Local\Programs\Python\Python39 or C:\Program Files\Python39. To know the exact path, see the How to Check the Python Path section below.
  5. Click OK to save the changes.
  6. Restart your computer. Go back to the previous section and verify if Python was installed successfully.

How to Check the Python Path

  1. Open the Command Prompt using Windows + R and type cmd, then press Enter.
  2. Type where python or (where python3) and press Enter.
  3. The path to the Python folder will be displayed. Copy it and go back to the previous section to add it to the system's PATH.
    Check Python Location
    Figure: Check Python Location

Conclusion

To recap, these are the steps to fix the 'python' is not recognized as an internal or external command error:

  1. Install Python, if you haven't already.
  2. Add Python to the system's PATH (most important step).

If you still cannot fix the error, please leave a comment below.

You can search for other posts at home page.
Minh Vu

Minh Vu

Software Engineer

Hi guys, I'm the author of WiseCode Blog. I mainly work with the Elastic Stack and build AI & Python projects. I also love writing technical articles, hope you guys have good experience reading my blog!