How to add Python to path variable in Windows ?
In this tutorial, you will learn how to add python to the path variable in your Windows PC.
Path Variable
Before we get into the core topic, let us understand what a path variable is and what does it do?
The path variable contains a list of directories. In turn, the directory holds an executable file for a command.
For instance, when you enter the word Python in the command prompt searches the path variable and returns you with the version and the installed date. But if you haven’t installed the Python IDLE it returns you with an error message that states that the specified command was not recognized.
So now, you have a basic understanding of what a path variable is.
How to add Python to the path variable in Windows?
- First, Locate the address of the Python IDLE.
- To find the address, search for the Python in the search bar.
- When the results appear, click on the “open file location”. It will take to the location of the file.
- Now, copy the location path by pressing CTRL+L.
- As you have copied the path, it’s time to add it to the path variable.
- Search for “Environmental Variables”, in the search bar/Windows.
- Click on that
- A menu pops up with two categories namely “User” and “System”.
- Click on the New option in the User section.
- A new dialogue box opens, you can enter the variable name and variable path in the dialogue box.
- Click Ok to confirm.
- You can see the variable has been added to the User section.
Note: You can give any name to the variable.
Tip:
Open your command prompt and enter the command Python. You can see the version number and other details in the resulting line.