Tutorials‎ > ‎

Getting Started

The aim of the Challenge is to write a program in Python, to run on the Raspberry Pi, to explore an idea in Maths. So, to get started, you will need access to a device that can run Python programs. Fortunately, you can use Python a variety of devices. For example, "standard" computers running Windows, Mac OS X or Linux; or on the Raspberry Pi itself (see here for setup instructions).

In the tutorials for this Challenge, we will be using Python version 2.7. We will also use IDLE: an Integrated Development Environment, which helps us to write, run, test and debug our codes. By default, IDLE comes with the version of Python we will install. Finally, we need to install some packages. These are "add-ons" for Python, which enhance the core language.

This page describes how to:
  1. Install Python
  2. Install IDLE (the Integrated Development Environment)
  3. Install some Python packages: numpy, scipy and pygame

on Windows, Mac OS X and Unix/Linux systems.

If you are using a Raspberry Pi, with the Raspbian operating system, then the good news is that Python and IDLE are installed by default, and all you have to do is add the packages. See here for details.

If you are using a school computer, IDLE may already be installed: check with your teacher.

If you have already installed Python, IDLE and the packages numpy, scipy and pygame, you can start the first tutorial.


Python is available to download from the official page. Select Python 2.7.3 Windows Installer. (Please do not choose the 64-bit version, even if you have a 64-bit machine, as it's not fully compatible with certain packages).  Save this file, and double-click it to run.  Choose the standard options (e.g. "all users"), so that the file is installed under C:\Python27\

Once Python is installed, you should be able to start IDLE via the Start Menu.  Go to Start -> All Programs -> Python 2.7 -> IDLE (Python GUI).  You should get a new window, entitled "Python Shell". To check that all is working as it should, try typing (at the >>> prompt) print "Hello world!" and press enter.  If it works, you should see:

>>> print "Hello world!"
Hello world!

Now we need to install three packages. The good news is that many packages are available for Python: there's a long list at pipy.python.org/pypi. The bad news is that installing Python packages in Windows is a bit of a headache! Fortunately, the three packages that we need (numpy, scipy and pygame) come with their own installers (.msi files).

numpy: Go to sourceforge.net/projects/numpy/files/ and download the latest version. This comes in a zip file, which you will need to unzip using (e.g.) WinZip. After unzipping, double-click on the
   To test whether the package has been correctly installed, open IDLE and at the prompt (>>>) type import numpy . If no error message appears, you have been successful.

scipy: Go to sourceforge.net/projects/scipy/files/ and download the latest version. This is an .exe file. Double-click to start the installation process and, once complete, test by entering import scipy at the Python prompt in IDLE.

pygame: Go to www.pygame.org/download.shtml and choose pygame-1.9.1.win32-py2.7.msi  . Double-click to install, use standard options, and test by entering import pygame at the Python prompt.

Mac OS X

Python comes pre-installed on Mac OS X, but due to Apple's release cycle, it is most likely an older version. To check, open Terminal.app (i.e. Applications/Utilities/Terminal) and type python. This should start the interpreter, and the first line tells you the current version, e.g.

Python 2.5.1 (r251:54863, May  5 2011, 18:37:34)

If you do not have version 2.7.x installed, then we suggest that you consider installing it now (to avoid incompatibility issues in code examples), as advised here.

From this page, download the relevant version for your operating system (32-bit for Mac OS 10.3 to 10.6, or 64-bit for Mac OS 10.6 and above). Save the .dmg file, double-click to open it, and then select Python.mpkg to begin the installation.

numpy and scipy: follow the instructions here for installing these packages

pygame: Go to www.pygame.org/download.shtml and choose the newest version (pygame-1.9.1release-python.org-32bit-py2.7-macosx10.3.dmg).