How to install and configure Python 2.7 on Windows 7, so you can execute the scripts from cmd

Python comes already installed in most of the linux based operating systems, probably because they’re mostly being used by heavy computer geeks who is passionate about coding and computer technologies in general. Unfortunately for those who make use of Windows 7, they have to manually download, install and configure Python on their machines completely by themselves.

The beginner who has no idea on how to properly setup Python 2.7 on their Windows 7 computer, is completely left with no official solutions; they have to swim completely alone unless they find a good tutorial on the internet, which explains everything in details so even a complete newbie can understand.

Having struggled myself in the beginning of my journey as a Python coder, I finally decided to write a very concise and easy to follow tutorial for anyone out there who is interested in installing and configuring Python 2.7 on their Windows 7 operating system.

What's the one thing every developer wants? More screens! Enhance your coding experience with an external monitor to increase screen real estate.

There are many ways one can configure Python programming technology on their Windows machine. The main purpose of this tutorial is to give one the proper instructions on how to install Python 2.7 on Windows 7 so they would be able to execute scripts directly from the Windows command line interface, which is widely known as cmd.

Before going on with the technical instructions, it is truly important for one to learn about environment variables and their purpose on Windows machines.

Windows environment variables

The information about Windows environment variables being shared in here is for complete beginners, for those who have no idea about them. It does not intend at all to cover them in details, but only for the purpose of understanding their important role in configuring Python 2.7 on Windows 7 so one can easily test and run their Python scripts from the command line.

An environment variable in Windows is mainly being used to point to specific paths of executables so the system can directly execute the programs from the command line, without the need of the absolute path. Each program installed on Windows 7, and I do believe in all operating systems available out there, gets placed in specific path, in a specific directory. For the system to keep track of these paths, the environment variables is being used.

One can easily access the environment variables of their Windows 7 machine, by following the instructions being shown below.

System Properties, Advanced, Environment Variables.

Download and install Python 2.7 on your Windows 7 computer

Before proceeding with the download and installation of Python 2.7 on your Windows 7 operating system, it is important to find out the system type. Do you have a 32 bit machine or a 64 bit one? Based on the architecture of your machine, you will download the specific Python 2.7 interpreter.

To find out your system type go to Start, right click on Computer and go to Properties; the following will come up.

As you can see from the above screenshot I have a 64 bit machine. I need to download the python installer for 64 bit system type.

Now go to the python official website and go to Downloads. Under Downloads click on the Windows category.

Depending on the system type you have, you have to download the right version. In the following screenshot everything is self explanatory so take a look at it and click on the python installer for your type.

python installation

Note: The version of python we need is 2.7.11

Download the right version of python for you and move it on Desktop like shown below.

python installation

Then do a right click on the python installer you just moved to Desktop and click on Install. The installation of python will start. The following box will show up.

python installation

If you don’t want to make python available to other users then just select the second option and click Next. I prefer to leave this as default.

The next box will ask you about the path where you want python to be installed. Please leave this as default as you are new to this stuff.

python installation

The C:\Python27\ is the path where our python installation is going to be placed. We will need this path for some configuration so make sure to save it in a notepad file.

C:\Python27\

Then the following will show up. Make sure to click Next.

python installation

Once the above step is completed, the installation of the official Python 2.7.11 interpreter will start on your Windows 7 machine.

python installation

When the setup is close to the finish, just click the Finish button like shown below.

python installation

We are not done yet!

If you go to your Windows 7 cmd and type python in there, like shown below, you will probably get some error, like path not found.

python

The error occurs because the system does not know where to look for the windows executeable named python. It does not exist.

python installation

You have to create it.

Setup python path in Windows 7

So what you need to do in order to execute python program from the command line is to edit the Path environment variable.

First go to My Computer, Properties, Advanced System Settings, Environment Variables. Then find the Path environment variable and click on it; then click Edit.

In the end add the following path.

C:\Python27\

After you have copied the above path and added it in the Path environment variable, click Ok. You will now be able to execute Python 2.7.11 directly from the cmd.

I also have a video in which this article is based. Please make sure to watch it after reading this tutorial, so you can get a better idea on the stuff being explained in here.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

One thought on “How to install and configure Python 2.7 on Windows 7, so you can execute the scripts from cmd”

Leave a Reply

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