your directory to the newly copied PyGame directory by typing cd pygame and pressing Enter.
Both of these commands are also shown above in Listing 19.4.
Installing Additional Software Packages
Now you need to install the following additional software packages:
libsdl-dev
libsdl-image1.2-dev
libsdl-mixer1.2-dev
libsdl-ttf2.0-dev
libsmpeg-dev
libportmidi-dev
libavformat-dev
libswscale-dev
These software packages, also called dependencies, are needed for the PyGame library. To install
these dependencies, type sudo apt-get install and then each software package name. You
can do several at one time, as shown in Listing 19.5.
LISTING 19.5 Installing Dependencies
Click here to view code image
pi@raspberrypi ~/pygame $ sudo apt-get install libsdl-dev libsdl-image1.2-dev
libsdl-mixer1.2-dev libsdl-ttf2.0-dev
Reading package lists... Done
Building dependency tree
...
pi@raspberrypi ~ $ sudo apt-get install libsmpeg-dev libportmidi-dev
libavformat-dev libswscale-dev
Reading package lists... Done
...
Setting up libsmpeg-dev (0.4.5+cvs20030824-5) ...
Setting up libswscale-dev (6:0.8.6-1+rpi1) ...
pi@raspberrypi ~ $
There are a lot of packages to install here. Don’t worry if you see lots of things going on during their
installation. Now would be a good time to go get a cup of coffee.
Building and Installing PyGame
Now that you have a copy of the PyGame source code, the development tools, and all the necessary
dependencies, you can finally build PyGame and install it. To do so, you need to enter two
commands.
First, type python3 setup.py build and press Enter. When that is complete, type sudo
python3 setup.py install and press Enter.
By the Way: Be Patient!
When you issue the above commands to build and install PyGame, each command may