How to Add Python to Windows Path?

Python is a popular and modern language that has a large community of programmers all over the world. It is used in various fields such as AI, ML, Robotics, data science, etc. To use Python with full functionality, we need to add installed Python to the windows path.

This post will describe various ways to add Python to the windows path.

Method 1: Downloading Python Latest Version

The simplest and easiest solution is downloading the latest version of Python from this site. To add python to Windows Path, you need to tick the check box “Add python.exe to PATH”, as shown in the following snippet:

Method 2: Add Python to Windows Path Using System Properties

If you don’t like to uninstall Python, you can use this method. In this method, you can add Python to the windows path using the system properties of “myPC”. Follow the below steps to add Python to windows:

Step 1:  Type Python in the start menu search and click on the “file location” to open the directory where  Python is installed on your system.

Step 2: Note down the Python installed location:

The given below is the Python application path where “Python” is installed in our system.

C:\Users\p\AppData\Local\Programs\Python\Python311

In addition, combine the “Scripts” name with the application path, using a backslash as shown below:

C:\Users\p\AppData\Local\Programs\Python\Python311\Scripts

Step 3: Now after knowing the Python application path and script folder location you can open the system properties of your computer using the run dialog box.

To open the system properties, type the “sysdm.cpl” in the run dialog box (windows+R).

Step 4: In the system properties, navigate to the advanced settings and click “Environment Variables”.

Step 5: Now, click on the “New” button to add the path of Python in windows.

Step 6: In the final step, input the variable name as “path” and the variable value as the Python application path followed by the Python script folder’s path. 

Variable Value:

C:\Users\p\AppData\Local\Programs\Python\Python311;C:\Users\p\AppData\Local\Programs\Python\Python311\Scripts

The above snippet shows that a “semicolon separates the Python application path and Python script folder path (;)”. After placing the name and path, click the ok button to add the Python path in windows.

Method 3: Add Python to Windows Path Using CMD Terminal

To add Python to windows path using the cmd terminal, you need to open the command prompt terminal as administrator. You can open the cmd by searching for it in the start menu:

After opening the cmd terminal, use the below command to add Python to the path. 

set path "%PATH%;C:\Users\p\AppData\Local\Programs\Python\Python310"

Note: Replace your installed Python application path with ours.

You can also temporarily add Python to the window path using the following command. But remember that whenever you open the cmd terminal, you must add Python again.

set Path=%Path%;C:\Users\p\AppData\Local\Programs\Python\Python310

Conclusion

To add Python to the windows paths, tick the check box “Add python.exe to PATH” while python installation, using system properties, or using the cmd. The simplest and most straightforward solution is to download the latest version of Python and tick the check box “Add python.exe to PATH” during installation. Alternatively, you can execute the “set path” command from the CMD, or you can add Python to the Windows path using system properties. This article explained how to add Python to the Path of windows utilizing various methods.