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

Minh Vu

By Minh Vu

Updated Nov 04, 2023

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

Disclaimer: All content on this website is derived directly from my own expertise and experiences. No AI-generated text or automated content creation tools are used.

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!

Contents

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 the 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 (the most important step).

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

Minh Vu

Minh Vu

Software Engineer

Hi guys 👋, I'm a developer specializing in Elastic Stack and Next.js. My blog shares practical tutorials and insights based on 3+ years of hands-on experience. Open to freelance opportunities — let's get in touch!

Comments

Be the first to comment!

Leave a Comment

Receive Latest Updates 📬

Get every new post, special offers, and more via email. No fee required.