Saturday, September 21, 2024
Google search engine
HomeLanguagesHow to add Python to Windows PATH?

How to add Python to Windows PATH?

Python is a great language! However, it doesn’t come pre-installed with Windows. Hence we download it to interpret the Python code which we write. But wait, windows don’t know where you have installed the Python so when trying to any Python code, you will get an error.

We will be using Windows10 and python3 for this article. (Most of the part is same for any other version of either windows or python)

Add Python to Windows Path

First, we need to locate where the python is being installed after downloading it. Press WINDOWS key and search for “Python”, you will get something like this:

Add Python to Windows Path

If no results appear then Python is not installed on your machine, download it before proceeding further. Click on open file location and you will be in a location where Python is installed, Copy the location path from the top by clicking over it.

Add Python to Windows Path

Now, we have to add the above-copied path as a variable so that windows can recognize. Search for “Environmental Variables”, you will see something like this:

Add Python to Windows Path

Click on that

Add Python to Windows Path

Now click the “Environmental Variables” button

Add Python to Windows Path

There will be two categories namely “User” and “System”, we have to add it in Users, click on New button in the User section. Now, add a Variable Name and Path which we copied previously and click OK. That’s it, DONE!

Check if the Environment variable is set or not

Now, after adding the Python to the Environment variable, let’s check if the Python is running anywhere in the windows or not. To do this open CMD and type Python. If the environment variable is set then the Python command will run otherwise not.

Python-HelloWorld-01

RELATED ARTICLES

Most Popular

Recent Comments