How to Add Python to Windows PATH

There are two ways to add Python to Windows PATH:

  1. Via the installation of a recent Python version
  2. Manually adding an Windows environment variable

Method 1: Install a Recent Python Version

You can easily add Python to Windows PATH by downloading a recent version of Python and then checking the Add python.exe to PATH box at the bottom of the setup screen:

Python setup screen

Finish the installation, and you are good to go! You can verify that you correctly added Python to PATH by typing the following command in your Command Prompt and hitting return:

python -V

The returned output should be a version number, e.g., "Python 3.11.1".

Method 2: Manually add Python to Windows PATH

If you have Python already installed and it's not added to PATH yet, you may apply the steps below to manually add Python to Windows PATH.

Step 1: Navigate to the Windows Environment Variables Screen

Press the Windows Key + R on your keyboard to open the Run dialog box and type sysdm.cpl to open the System Properties:

Run dialog box

Go to the Advanced tab and then click on Environment Variables…:

System Properties box

That should open the Environment Variables window, where you can add/edit your paths.

Environment Variables box

Step 2: Add a Path variable

Under the User variables box:

  • Click on New... if no Path variable is present,
  • Otherwise select the Path variable and then click on Edit… instead.

You should then see the New User Variable box.

New Environment Variable box

Type Path in the Variable name field.

For the Variable value you will need to know the path to the Python that is installed on your computer.

To find the path, search python, right click on the relevant search result and click Open file location:

Search box

In the Windows Explorer right click on the Python icon and click on Properties:

Properties box

Copy the target path without the python.exe part:

Target path

Here is an example of a Python application path:

C:\Users\...\Programs\Python\Python311

You also need the Python Scripts path. The Scripts folder is located within the Python application path:

C:\Users\...\Python\Python311\Scripts

Both paths go into the Variable value field concatenated by a semicolon:

...\Python\Python311;...\Python311\Scripts

New Environment Variable box

Finally, hit OK and you will see your Path variable in the User variables section. Don’t forget to hit OK in the Environment Variable window to confirm your changes.

That's it, you just manually added Python to the Windows Path!

You can verify that you correctly added Python to PATH by executing the following command in your shell:

python -V

The output should be a version number.