How to Add Python to PATH Environment Variable on Windows 11

By
Aditya Dhanraj
Aditya Dhanraj is a Web Developer by profession and Content Writer by passion. He loves to write about coding and programming. When he is not writing,...
4 Min Read
Disclosure: This site uses affiliate links. We may earn a commission at no extra cost to you. Thanks for your support!
How to Add Python to PATH Environment Variable on Windows 11
Quick Tips
  • Always select “Add Python to PATH” during installation to avoid command-line errors later.
  • If you see the message “python is not recognized as an internal or external command,” it usually means Python isn’t added to the PATH.
  • After updating the PATH variable, restart your computer to apply the changes.

If you’re getting errors when running a Python program on Windows 11, the issue is often related to the Python PATH environment variable. This usually happens when the Add Python to PATH option isn’t selected during installation.

The Python PATH environment variable tells Windows where Python is installed on your system. If it’s missing, Windows can’t locate the Python executable, which leads to errors when you try to run Python scripts, use pip, or activate virtual environments from the Command Prompt or PowerShell.

Add Python to PATH Environment Variable on Windows 11

If Python isn’t added to the PATH, you may see an error like this: “python is not recognized as an internal or external command, operable program or batch file.

When you run a Python command, Windows searches for the executable using the system PATH variable. If Python’s installation directory isn’t listed, Windows simply can’t find it, resulting in the error.

Here’s how you can fix the issue by adding Python to the PATH environment variables on Windows 11.

To do that, follow the following steps:

1. Click on the search option and search for python.exe. Right-click on it and select the open file location option.

Open Python Instalaltion Location

2. Copy the installation path of Python.

3. Then continue with the next steps below.

Copy Python Installation Path

4. Open the Settings using the Window + I key.

5. Click on the System tab from the left panel and click on the About option present to the right of your screen.

About Windows PC

6. Now, click on the Advanced system settings option to access the System Properties.

Advanced System Settings Option

7. It will open the system properties window. Here, click on the Advanced tab and select the Environment Variables button.

System Properties Settings

8. Here, you’ll get two variable options. One is for user variables and another one is for system variables. Under the system variable section, select the Path variable and click on the Edit button.

Edit Path Variables

9. Now click on New and add the Python installation location.

10. After that, click on OK to save the changes.

Save the Path Variables

Verify the Python PATH Configuration

To confirm everything is working correctly, you can run Python command in the commad prompt. Here’s how:

1. Open the Command Prompt.

2. Type python and press the [Enter] key.

Verify Python Installation

If the command returns the currently installed version of Python, it means you’ve successfully added Python to the PATH environment variable.

Conclusion

Adding Python to the PATH environment variable on Windows 11 is a small but critical setup step. Without it, Windows can’t locate the Python interpreter, which causes errors when running scripts, installing packages with pip, or working with virtual environments.

Once the correct Python path is added, you can run Python commands from any directory without issues. This one-time configuration makes your Python development environment on Windows 11 more reliable and saves you from common command-line errors in the future.

Want to see more helpful guides like this? Add thecoderworld as your preferred source on Google so our content appears more often in your feed.

Share This Article
Follow:
Aditya Dhanraj is a Web Developer by profession and Content Writer by passion. He loves to write about coding and programming. When he is not writing, he must be developing something!
Leave a Comment

Leave a Reply

Your email address will not be published. Required fields are marked *