Installing Python

Published

2022-08-05

Introduction

So, you want to write programs in Python. Yay! Python is a great first language for learning how to write computer programs. If you’ve had some experience with other languages, you’ll no doubt find many similarities—and a few differences.

There are a few options, depending on your personal computer, and your preferences. It may be the case that you already have a reasonably current version of Python on your computer. You should be using Python 3.10.0 or later.

Checking for existing installation

From a terminal or command prompt (where $ indicates the prompt; yours may vary), type:

$ python -V

and if Python is installed on your machine, this command should print something like

Python 3.10.0

If your Python version is less than 3.10.0, you should install a newer version. If the python -V command reports a version starting with 2, try this instead:

$ python3 -V

and make note of the version.

If you get a message like command not found or (on Windows) python was not found... then you’ll need to install Python.

Installing Python

If you need to install Python, you have a few options.

Thonny (with bundled Python)

Thonny is an integrated development environment (IDE) for Python, and it comes with a bundled version of Python. The current version of Thonny is 4.1.4 (released 2023-11-19), and this comes with Python 3.10. Thonny is available for macOS, Windows, and Linux.

Installing Thonny

  • Visit https://thonny.org/
  • You should see a box with links for download.
  • Choose the downloadable installer for your OS.
  • Once you’ve downloaded the installer, double-click to start the installation.
  • Follow the instructions provided by the installer.

When done, launch Thonny. You should see a window which looks like this.

Figure 1: Thonny window

If you see a window like this, you should be good to go!

For more on Thonny, see:

A little bug

There’s a minor bug in Thonny for Windows that can result in menu items becoming formatted in tiny (well neigh microscopic) text, making menus unreadable. If this happens (assuming default installation):

  1. Close Thonny.
  2. Delete the folder: C:\Users\[USERNAME]\AppData\Roaming\Thonny where [USERNAME] is replaced with your actual username.
  3. Reopen Thonny and use default settings.

For more on this issue, see Thonny Issue Tracker #1113.1

Python and IDLE

You can get Python from the official Python website at https://www.python.org.

As of this writing, the current version of Python is 3.12.1 (released 2023-12-08). Downloadable installers are available at https://www.python.org/downloads/release/python-3121/.

  • For macOS 10.9 or later, choose “macOS 64-bit universal2 installer”.
  • For reasonably current versions of windows, choose “Windows installer (64-bit)”.
  • Launch the installer and follow the instructions.

If you’re using Linux, it’s probably best to use your distro’s package manager.

Once the installation is complete, try launching IDLE. IDLE is short for integrated development and learning environment. You should see a window which looks like this.

Figure 2: IDLE window

If you see a window like this, you should be good to go!

For more on IDLE, see:

Installing with Homebrew (macOS only)

If you are using a Mac, and are comfortable with a more DIY approach, you may use Homebrew to install Python.

To install Homebrew, visit https://docs.brew.sh/Installation.

Information on installing Python with Homebrew is available at https://docs.brew.sh/Homebrew-and-Python.

Anaconda

If you use Anaconda, that’s OK, and if you’re taking a course in data science it’s likely that this is the recommended approach to installing Python. Be cautious with Anaconda—it can have a large footprint. Anaconda cannot be supported by teaching assistants, help desk, etc. If you feel you must use Anaconda, I’d recommend Miniconda as this installs minimum dependencies and thus has a smaller footprint.

Summary

Regardless of your choice (above), you should have a version of Python 3.10.0 or above.

Note on other IDEs

You’re welcome to use another IDE when writing Python code (you’re not required to use IDLE or Thonny). However, given the variety of other IDEs we can’t provide technical support for anything other than Thonny or IDLE. That said, so long as you have Python 3.10.0 or above, there are plenty of other options for IDEs, including:

  • JetBrains PyCharm (which is what I use in academia and professionally)
  • Visual Studio Code
  • Spyder (the scientific Python development environment)

Additional resources

Original author: Clayton Cafiero < [given name] DOT [surname] AT uvm DOT edu >

This material is for free use under either the GNU Free Documentation License or the Creative Commons Attribution-ShareAlike 3.0 United States License (take your pick).

Footnotes

  1. Hat tip to Sami Connolly for contributing information about this issue.↩︎