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:
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:
- Add Python Path to Windows at Installation Time
- 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
On the installation window, you should check the box
Add Python 3.* to PATH as shown below:
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.
Advanced System Settings from the System window as given below.
Now open Environment Variables window by Clicking on
Environment variables… as given below:
Add new User Variable by clicking on New Button inside User Variables box.
After Clicking on the
New... button you should see the following window opened:
Here the important one. We need the following two paths to add inside Variable Value:
- Python Directory PATH
- Python Scripts Directory PATH
Navigate to Python directory and copy the Python directory path:
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:
Navigate to Python Scripts directory and copy the path:
Now append the above path to
variable value like give below and click on
Now on Environment variables windows also click on the
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:
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.