Installing and Running Python 3

Installing

To install the Python interpreter on your computer, follow these steps:

Linux

Run your system's package manager. (On Ubuntu or Debian, I recommend running Synaptic). Find the package for Python 3. On many systems (e.g. Ubuntu) this will be called 'python3'. Install it.

macOS

In a web browser, go to the Python download page. Click the button "Download Python 3.7.4" (it may have a larger number if a newer version is available). When the installer finishes downloading, run it, and accept all the installation defaults.

Windows

In a web browser, go to the Python download page. Click the button "Download Python 3.7.4" (it may have a larger number if a newer version is available). You will see a page with information about the latest Python release. Scroll down to the section titled "Files". Click the link named "Windows x86-64 executable installer". You'll see a message "Do you want to run or save python-3.7.4-amd64.exe from python.org?" Click Run.

You'll now see a window "Install Python 3.7.4 (64-bit)". In this window, be sure to check the box "Add Python 3.7 to PATH". Now click "Install Now". You'll see a message "Do you want to allow this app to make changes to your device?" Click Yes.

Running

To run Python:

Linux

Run a terminal. (On many distributions, you can do this by pressing the Super key, then typing "terminal"). In the terminal window, type "python3" at the shell prompt.

macOS

Run a terminal: press Command + Space, type "terminal", then press Enter. In the terminal window, type "python3" at the shell prompt.

Windows

Run a terminal: press the Windows key, type "command", then press Enter. In the Command Prompt (terminal) window, type "python" at the shell prompt.

All systems

On all the systems above, if your Python installation is successful, then running Python should result in output that looks something like this:

$ python3
Python 3.7.3 (default, Aug 20 2019, 17:04:43) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

Editing code

To edit Python code, you need a text editor. There are hundreds of different editors available. You will want to use a programmer's editor that understands Python syntax and can highlight your code. If you're not sure what to use, I recommend Visual Studio Code, a powerful editor and development environment. It will run on any platform (i.e. on Linux, macOS, or Windows).