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).

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.

If you want to install python on other platform. You might like to see this article where we discuss about python install linux.

References

Leave A Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.