Installing Python

Unless the Python interpreter is already available on your computer, you need to download, install and configure the latest version of Python.

Because Python is a cross-platform language, you can use it on a few different operating systems. In this course, I will show you the installation process on the three most popular platforms: Windows, Linux, and Mac OS X.

Windows Installation

Check if Python is already installed

On Windows 10, click the magnifying glass to open Search Windows.

Start typing: programs and features. When the icon appears, click it.

From the new screen, you should see whether there is Python installed. In my case, I have two versions of Python on my PC: 2.7 and 3.5.

If you’ve started to learn Python and you don’t have to work with an old Python 2 code, you can just install Python 3.

Download Python

  1. Open the Python website from your browser and download the newest version – https://www.python.org/downloads/.
  2. Click the download button to save the Exe file on your hard drive (Python 3.6.0 is the newest release at the time of writing this tutorial).
  3. After the file is downloaded, click it to start the installation process.

Basic Installation

  1. If you want to install the default settings, check Add Python 3.6 to PATH and click Install Now. It will add Python to environment variables, so you don’t have to do it manually. Adding it to the path allows you to use the python command from any place, instead of pointing to the python directory each time.
  2. Wait until the process finishes and click close.

Advanced Installation

Customize installation gives you the option to configure a few things.

You can choose the installation folder and decide whether you want to install Python for all users (if you have admin privileges).

The second thing that is important is PIP. This is the recommended installer for Python packages. In the later part of this tutorial, I’ll show you how to install PIP if you omitted this option in the installation process.

Checking the environment variables

  1. In Search Windows, start typing “environment”, then choose Edit the system environment variables.
  2. Click the Environment Variables button.
  3. Now you have two options: user variables and system variables.

I’ve installed Python for all users so I will check whether Python 3.6 is added to the PATH under system variables. If you don’t have admin privileges and you installed Python for one user, check User variables.

Check Python from the Command Prompt

In Search Windows, type cmd, then click Command Prompt. Because you’ve already added Python to environment variables you can use Python commands from any place.

In my case, the result is Python 3.6.0. If Python is not added or added incorrectly to the PATH, a terminal will display information that the command is not recognized.

Installing PIP

If you haven’t installed PIP during the advanced installation, you can do it now. In the command prompt enter the following code:

After the short installation process which will be displayed on the terminal, you will be able to use the pip command to install Python packages.

Installing IDLE

IDLE is an Integrated DeveLopment Environment. It is a simple IDE written in Python and Tkinter. IDLE is optional and it’s not required to use.

You can install it during the customize installation by checking tcl/tk and IDLE.

If you haven’t done it already, you can install it now.

Go to Programs and Features and select your Python installation, next click Uninstall/Change and choose Modify. Make sure that tcl/tk and IDLE is selected, then click Next. On the second screen, click Install and wait for the installation process to finish.

In Search Windows, type IDLE and click the icon. Now, you can use it as your Python editor.

Linux Installation (Ubuntu)

Python is installed by default on almost every Linux system.

Check if Python is already installed

To check whether Python is installed on your system, use the following command:

Python 2.7.12 is already installed.

Now, let’s use another command to check if we have Python 3 installed.

So we have both versions of Python installed.

Update Python

But the version of Python 3 that is installed is not the most recent. Let’s update it to the actual one (3.6).
But first, let’s install deadsnakes. This package makes easy to install multiple versions of Python.

After the installation process finishes, you will be able to use python3.6 as your command to run the newest version of Python.
Check whether Python 3.6 is installed correctly.

Installing IDLE

To install IDLE on Linux execute the following code from the terminal.

idle3 means that this IDLE is created for Python 3.

Mac Installation

Check if Python is already installed

Similarly to Linux, Python is installed on most OS X systems by default. Enter the following command to see what version (if any) of Python you have on your system. Open the terminal and type:

If the result is Python 2 version, you should also try a command to check if you have Python3 installed.

This will probably result in an error, but it’s worth checking before you start installing a new version on your Mac.

Download and Install Python

  1. Go to https://www.python.org/downloads/ and download Python 3 package for Mac OS X.
  2. Run the file.
  3. Follow the steps of the installation process.
  4. Wait for the installation process to finish.
  5. When everything is OK you will get The installation was successful message.