Installing the necessary software¶
In order to do the exercises in this book, you will need Python, Git, and a suitable text editor or Integrated Development Environment. Visual Studio Code is recommended as the IDE.
Instructions are provided here for Windows, MacOS, and Linux. Chromebook users can follow the Linux instructions if they first activate Linux on their Chromebook.
Homebrew for Mac¶
The easiest way to install additional programming software on a Mac is to first
install the Homebrew package manager. Open a terminal (press ⌘ +
space to open Spotlight Search and then type terminal
in the search
window) and run the following command:
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Don’t type the $. That’s the terminal prompt (it might appear as another symbol such as % for you).
This will start the install process, and ask you for confirmation before installing Homebrew.
Further documentation about Homebrew and its dependencies is available on the Homebrew website.
Python¶
There are a number of different ways of obtaining Python, depending a little on which operating system your computer runs. The routes suggested here are ones that have been easiest for students taking the course at Imperial, however any sufficiently recent Python should be sufficient.
Windows¶
Install Python from the Microsoft Store.
MacOS¶
MacOS comes with Python 3, but it’s a cut down version not suitable for our purposes. Instead, install Python from Homebrew:
$ brew install python3.12
Linux¶
Every Linux distribution ships with Python 3 by default. However, they don’t always have the Python package manager Pip installed by default. We will need that so you’ll need to use your distribution’s package manager to install it. For example on Ubuntu or Debian you would run:
$ sudo apt install python3-pip
You can also install newer versions of Python on Ubuntu or Debian using the dead snakes package archive.
On Fedora and related distributions you would run:
$ sudo dnf install python-pip
Git¶
Git is a revision control system. Revision control systems enable you to keep track of the different versions of a piece of code as you work on them, and to have these versions on different computers as well as backed up in the cloud. We will use Git and GitHub classroom as a mechanism for distributing, working with and submitting code exercises.
Windows¶
Download and install the Git package.
MacOS¶
MacOS comes with a perfectly acceptable Git installation. However you can also install a more recent version from Homebrew:
$ brew install git
Linux¶
Use your distribution package manager to install Git. For example on Ubuntu or Debian:
$ sudo apt install git-all
On Fedora:
$ sudo apt install git-all
Visual Studio Code¶
Visual Studio Code is a Python-aware Integrated Development Environment (IDE). This means that it incorporates editing files with other programming features such as Debugging and testing, Git support, and built-in terminal.
Windows¶
MacOS¶
Use Homebrew to install Visual Studio Code:
$ brew install visual-studio-code
Linux¶
Download the package and then use your package manager to install it following these instructions.