Open In App

How to add Python to Windows PATH?

Improve
Improve
Like Article
Like
Save
Share
Report

Python is a great language! However, it doesn’t come pre-installed with Windows. Hence we download it to interpret the Python code that 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 Windows 10 and python3 for this article. (Most of the part is the same for any other version of either Windows or Python)

Add Python to Windows Path

Below are the ways by which we can add Python to the Windows path:

Step 1: Locate Python Installation

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

Screenshot-from-2023-12-05-18-24-44

Step 2: Verify Python Installation

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

Step 3: Add Python to Path as an Environmental Variable

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:

Screenshot-from-2023-12-05-18-24-58

Click on that

Add Python to Windows Path

Now click the “Environmental Variables” button

Add Python to Windows Path

Step 4: Add Python Path to User Environmental Variables

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!

Step 5: 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 ArticleDownload PyCham IDE


Last Updated : 07 Dec, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads