How to install python in windows

If you are using Windows you have to do some more configuration than using a Unix-like system (Linux, Mac). That’s just because.

The only thing you need is to add Python and pip to the PATH to have it available through the command line. And this you can achieve in three fashions.

One is a temporal one where you write a batch script which launches and sets the PATH every time you open up the command line through this script. I will not go into deeper detail how to achieve this, because this is not the best approach in my opinion and sometimes you want to access Python from where you are.

The two permanent solutions are the same, the only difference is that in one version you have to do the same steps manually as the other does automatically.

The automatic version is to set the checkbox “Add Python 3.5 to PATH” when you install Python. This creates automatically the entries required in the PATH which enables you the access to Python through the command line.

Alternatively if you choose “Customize installation” there you have the option too to add Python to the PATH.

Add Python to PATH during installation

The second version is for those who missed the previous step. In this case you have to edit your PATH manually. Now here are the steps:

Open up the “Start menu” on your Windows and select “Control Panel”:

Python installation in Windows Menu

Open up the Control Panel

In the “Control Panel” select “System and Security”:

Python installation in Windows

Select System and Security

In the “System and Security” view select “System”:

Python installation in Windows System

Select System

In the “System” view select “Advanced system settings” from the left-hand side:

Python installation in Windows Windows Control

Click Advanced system settings

In the “Advanced system settings” window select “Environment Variables…” from the bottom part:

Python installation in Windows Advance

Open up Environment Variables

Now you can search for the “Path” entry in the lower part of the window called “System variables”. Here you should select the entry and click on “Edit…”. Now add the installation location of your Python to the end of this entry, and separate it with a semi-colon from the previous entries. For example I would enter the following:

C:\Python3\Scripts\;C:\Python3\

The Scripts folder under the Python installation contains pip so it is wise to add it to the PATH too.

Python installation in Windows Env Variable

System variables

Alternatively you can create an environment variable for your user only. In this case select “New…” in the upper part of the window called “User variables for …” and add a new entry where the Variable is set to “PATH” and the value is the location where you installed Python — the same as in the previous step.

Python installation in Windows Enviornment Variable

User variables

Now if you open up a command line and enter python you should see something like the following command prompt:

Python installation in Windows command prompt

Command prompt with Python

And this was it. Now you can access Python every time you open up a command line.

Series Navigation<< Python basics — a.k.a. “Hello World!” and how to achieve itPython Numbers and strings >>
By | 2015-11-14T16:56:21+00:00 November 14th, 2015|Python Tutorial|0 Comments

About the Author:

Leave A Comment