How to Install Python on Windows

Robert Torok September 23, 2018
How to Install Python on Windows

Python is a general-purpose programming language that is widely used almost everywhere, most notably in:

  • Data Mining and Machine Learning
  • Web development (Django and Flask)
  • Automation (scripting)

In case you're a beginner, it's also a great language to get familiar with programming. Perhaps the language you should start with. Python has a very elegant and friendly syntax which makes the learning process easier compared to other programming languages.

This short post helps you download and install Python on your Windows based computer.

Installation

Well, let's get started! The installation process is fairly straightforward. Open https://www.python.org and navigate to the Downloads section where the latest stable version is available for download. Go ahead, click the button to start the download.

Python homepage

The download process should not take too much time, the installer of Python 3.7.0 takes only 25 megabytes of space.

Once the download is finished, start the installer.

It's by default unchecked, however, it's highly recommended that you add Python to the PATH environment variable. This will allow you to run Python everywhere (every directory) without exactly specifying Python's executable location.

Installer

You should have Python in your Start menu once the installation is finished:

Appearing in Start menu

In order to verify that Python has been successfully installed, open a command prompt (pres Windows button + R, type cmd and hit enter). In the command prompt type python then hit enter. If everything goes well, the interactive Python console welcomes you:

Python shell

That's it! Congratulations, you've successfully installed Python to your computer.

Troubleshooting

In case Python doesn't start, you might see something like the following error message:

Executable not found

This means the python executable was not found in the PATH environment variable. This happens if the Add Python to PATH checkbox was not selected during the installation process.

Of course, you could just re-install Python and select the checkbox, however, it's really not the best way to solve this problem. Instead, you can also extend the PATH variable with the python executable's directory.

In order to do this, open the Start menu and start typing environment variables:

Environment variables

Open it, then click the Environment Variables button:

Finding out the directory

Select the Path variable for your user and click Edit:

Setting the PATH variable

Add the directories where the python executable is located. Basically, it should be in the %USERPROFILE%\AppData\Local\Programs directory, however, it might vary depending on the actual Python version.

To figure out what the exact directory of your Python executable is, locate Python in your Start menu, right click on it and select Open file location. This will bring you to the Python shortcut's directory, which is still not the executable's direction - to find it out, click on the Python shortcut file's properties and copy the Target variable:

The correct path variable

Once you have the location, add the following entries to the Path variable:

  • %USERPROFILE%\AppData\Local\Programs\Python\Python37-32\Scripts\
  • %USERPROFILE%\AppData\Local\Programs\Python\Python37-32\
The variable set properly

Click OK, and you're done.