How Do I Set the Path for Python in Windows?

Reading Time: 3 minutes

Python is a powerful programming language that is scalable and uses code that is readable and clear for all types of projects. Python is also available across a number of operating systems, making it a popular choice for developers. If you are using Python on your Windows operating system, you may need to adjust your System Environment Variables to simplify utilizing Python on your server. 

Method 1

The latest Python installer for Windows can set the System Environment Variable Path automatically if selected during the installation process.

Method 2

This method involves modifying the path of an existing Python installation. To verify if the path setting is correct or current, follow these steps.

Step 1.

Open an administrative command prompt by going to
Start > Windows System > Command Prompt.
Next, right-click on the command prompt icon, choose More, then choose “run as administrator“.

command

Step 2.

Once the Type in the python command, and then press Enter. If the System Variable Path is correctly set, you should receive output similar to what is shown below.

command2

When using Powershell, the output will look like this.

command3

If an error is seen indicating that the Python command is unknown, but we have confirmed that Python is installed and can be launched from within its directory, we will need to add the Python path to the System Environment Variables.

Step 3.

To begin, type in Win+R to open a run dialog box, Then type in sysdm.cpl and hit enter. This will open the System Properties dialog box.

Click on the Advanced tab at the top and then on the Environment Variables button at the bottom.

Step 4.

This will open both the User and System Variables dialog box.

env.variable2

Step 5.

Now, we will create a new User Variable. Click on the New button.

A new window will open. Now we will enter the following data in the open fields.

  • Python
  • C:\Users\*username*\AppData\Local\Programs\Python\Python38 (change the variable value to match your actual installation path).
new.user.variable

Step 6.

Next, find the Path entry in the System variable section, select it and then click the Edit button.

system-variables-path

A new window will open. We will create a New entry that matches the Path variable we created in step 5 with the addition of “\Scripts” to the end of the entry like so.(C:\Users\*yourusername*\AppData\Local\Programs\Python\Python38\Scripts\

new sys env variable

Step 7.

Click the OK button on all three open windows to save the entries.

We can now verify that we have completed this task successfully by opening a new administrative command prompt windows and typing in “python” (without the quotes).

command2

We will receive a response similar to what is shown above. By following these quick steps, you’ll be able to access Python from any command prompt.

Note:
The installation of Python software falls under our Beyond Scope Support. This means it is not covered under our managed support, but we will do what we reasonably can to assist. Find out more in our blog article What Is Beyond Scope Support?

Python is one of the most popular programming languages existing today.
Our talented Support Team is full of experienced System Administrators and technicians who have intimate knowledge of multiple web hosting technologies, especially those discussed in this article.

Should you have thoughts or questions, we are always available to assist 24 hours a day, 7 days a week 365 days a year. We pride ourselves on being The Most Helpful Humans In Hosting™!

If you are a Fully Managed VPS server, Cloud Dedicated, VMWare Private Cloud, Private Parent server or a Dedicated server owner and you are uncomfortable with performing any of the steps outlined, we can be reached via phone @800.580.4985, a chat or support ticket to assisting you with this process.

Author Bio

About the Author: David Singer

I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....

Refer a friend and get a $50 hosting credit!