How to Add Python to Windows PATH

How to Add Python to Windows PATH
How to Add Python to Windows PATH

Add Python to Windows PATH

In this tutorial, you are going to learn how to add Python to Windows Path. When executing python commands you may see the following error if you haven’t added Python to Windows Path:

‘python’ is not recognized as an internal or external command, operable program or batch file

To stop the above error completely you have to add Python to Windows Path.
There are two ways to add Python path to Windows Path:

  1. Add Python Path to Windows at Installation Time
  2. Add Python Path to Windows Manually

If you have already installed Python on your system then follow the second method otherwise follow the first one.

1. Add Python Path to Windows at Installation Time

First, download the latest version or the version you want of Python from Python official download page. The current latest version of Python available for installation is 3.8.0 at the time of writing this tutorial.

After completing the download process, start the installation of the downloaded Python .exe file.

On the installation window, you should check the box Add Python 3.* to PATH as shown below:

How to Add Python to Windows PATH - Python Installation
How to Add Python to Windows PATH – Python Installation

Now complete the installation process. After completing the installation process you have successfully added Python 3.8 to Windows Path.

Confirm the installation and Check the version of Python by running following command inside Command Prompt:

2. Add Python Path to Windows Manually

First, Open the System properties window by Right Click on This PC -> Select Properties.

How to Add Python to Windows PATH - This PC properties
How to Add Python to Windows PATH – This PC properties

Select Advanced System Settings from the System window as given below.

How to Add Python to Windows PATH - Advanced Settings
How to Add Python to Windows PATH – Advanced Settings

Now open Environment Variables window by Clicking on Environment variables… as given below:

How to add Python to Windows PATH - Environment Variables
How to add Python to Windows PATH – Environment Variables

Add new User Variable by clicking on New Button inside User Variables box.

How to Add Python to Windows PATH - User Environment Variables
How to Add Python to Windows PATH – User Environment Variables

After Clicking on the New... button you should see the following window opened:

How to Add Python to Windows PATH - Add New User Variable
How to Add Python to Windows PATH – Add New User Variable

Here the important one. We need the following two paths to add inside Variable Value:

  1. Python Directory PATH
  2. Python Scripts Directory PATH

Navigate to Python directory and copy the Python directory path:

How to Add Python o Windows Path - Python Directory
How to Add Python o Windows Path – Python Directory

Now set the variable name as Path. Then paste this path to the variable value box by adding the semicolon ; at the end of it, as given below:

How to Add Python to Windows Path - Python directory path to user variable value
How to Add Python to Windows Path – Python directory path to user variable value

Navigate to Python Scripts directory and copy the path:

How to Add Python to Windows PATH - Python Scripts Directory
How to Add Python to Windows PATH – Python Scripts Directory

Now append the above path to variable value like give below and click on OK button:

How to Add Python to Windows PATH - Append Python Scripts directory path to variable value
How to Add Python to Windows PATH – Append Python Scripts directory path to the variable value

Now on Environment variables windows also click on the OK button:

How to Add Python to Windows PATH - Submit Environment Variables
How to Add Python to Windows PATH – Submit Environment Variables

To confirm, open command prompt and run following command inside it:

If you see the following output you have successfully added Python to Windows Path:

How to Add Python to Windows PATH - Confirm Python Path Added
How to Add Python to Windows PATH – Confirm Python Path Added

Conclusion

You have successfully learned How to Add Python to Windows PATH. If you have any queries regarding this tutorial please don’t forget to comment below.

LEAVE A REPLY

Please enter your comment!
Please enter your name here