The first step in installing PyGame is to make sure your system is all up-to-date, with any missing
items installed. You do this by logging in to your Raspberry Pi, and typing in at the shell prompt the
command sudo apt-get dist-upgrade --fix-missing, and press Enter. (Note the two
hyphens in front of fix-missing.) Listing 19.2 shows this process in action.
LISTING 19.2 Getting Your System Up to Date
Click here to view code image
pi@raspberrypi ~ $ sudo apt-get dist-upgrade --fix-missing
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
pi@raspberrypi ~ $
You can see in Listing 19.2 that no items are missing, and all the packages are up-to-date.
If your system is not up-to-date, the process will ask if you want to install the packages. Answer Y to
have the packages installed.
Watch Out!: Check Available Space
You need to install several libraries and packages in order to obtain PyGame. Be sure
to keep a close eye on the available space you have on your Raspberry Pi’s storage
medium. Use the shell command df to see a quick summary of the space currently
used.
Installing the Tools for Building Python Modules
Next, you need to install some tools for building Python modules. To do so, at the shell prompt type
sudo apt-get install python3-dev python3-numpy and press Enter. Listing 19.3
shows the successful installation of these tools.
LISTING 19.3 Installing Development Tools
Click here to view code image
pi@raspberrypi ~ $ sudo apt-get install python3-dev python3-numpy
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
idle3 libexpat1-dev libpython3.2 libssl-dev libssl-doc libssl1.0.0 python3
python3-minimal python3.2 python3.2-dev python3.2-minimal
Suggested packages:
...
Setting up python3-dev (3.2.3-6) ...
Setting up python3-numpy (1:1.6.2-1.2) ...
Processing triggers for menu ...
pi@raspberrypi ~ $