Chapter 2: Setting Up Python

This chapter introduces setting up python.

2.1 A Note On Python Versions

Many operating systems, such as macOS and Linux, come with Python pre-installed. The version of Python that comes with your operating system is called your systemPython.

The system Python is almost always out-of-date and may not even be a full Python installation. It's essential that you have the most recent version of Python so that you can follow along successfully with the examples in these pages.

It's possible to have multiple versions of Python installed on your computer. In this chapter, you'll install the latest version of Python 3 alongside any system Python that may already exist on your machine.

2.2 Windows

Follow these steps to install Python 3 and open IDLE on Windows.

Install Python

Windows systems do not typically ship with Python pre-installed. Fortunately, installation does not involve much more than downloading the Python installer from the python.org website and running it.

Step 1: Download the Python 3 Installer

Open a browser window and navigate to the download page for Windows at python.org.

Step 2: Run the Installer

Run the installer by double-clicking on the downloaded file. Make sure you check the box that says Add Python 3.x to PATH to ensure that the installer places the interpreter in your execution path.

Open IDLE

You can open IDLE in two steps: Click on the start menu and locate the Python 3.8 folder. Then open the folder and select IDLE (Python 3.8).

2.3 macOS

Follow these steps to install Python 3 and open IDLE on macOS.

Install Python

Most macOS machines come with Python 2 installed. You'll want to install the latest version of Python 3. You can do this by downloading an installer from the python.org website.

Step 1: Download the Python 3 Installer

Open a browser window and navigate to the download page for macOS at python.org. Select macOS 64-bit/32-bit installer.

Step 2: Run the Installer

Run the installer by double-clicking on the downloaded file. Press Continue and Agree to the software license. Click Install to install Python.

Open IDLE

You can open IDLE in three steps: Open Finder and click on Applications. Locate the Python 3.8 folder and double-click on it. Double-click on the IDLE icon.

2.4 Ubuntu Linux

Follow these steps to install Python 3 and open IDLE on Ubuntu Linux.

Install Python

There is a good chance your Ubuntu distribution has Python installed already, but it probably won't be the latest version, and it may be Python 2 instead of Python 3.

To find out what version(s) you have, open a terminal window and try the following commands:

$ python --version
$ python3 --version

One or more of these commands should respond with a version. If the version shown is Python 2.x or a version of Python 3 that is less than 3.8, then you want to install the latest version.

Ubuntu 18.04+: Run sudo apt-get update && sudo apt-get install python3.8 idle-python3.8

Ubuntu 17 and lower: Add the deadsnakes PPA and install Python 3.8.

Open IDLE from the command line by typing idle-python3.8.

Chapter Summary

This chapter introduces setting up python.

100%