Compiling Pygame for Python 3.2 in Xubuntu

Posted: November 20, 2012 by Sir in Xubuntu Stuff

To install Pygame for Python 3 on Xubuntu, you need to build it yourself.

Here’s how:

Under Accessories menu, open Terminal.

Change to your home directory.


Get Pygame source code.

sudo apt-get install mercurial
hg clone
cd pygame

Install dependencies.

sudo apt-get install python3-dev 
sudo apt-get install python3-numpy 
sudo apt-get install libsdl-dev 
sudo apt-get install libsdl-image1.2-dev 
sudo apt-get install libsdl-mixer1.2-dev 
sudo apt-get install libsdl-ttf2.0-dev 
sudo apt-get install libsmpeg-dev 
sudo apt-get install libportmidi-dev 
sudo apt-get install libavformat-dev 
sudo apt-get install libswscale-dev
sudo apt-get install libjpeg-dev
sudo apt-get install libfreetype6-dev

Build and install Pygame.

python3 build
sudo python3 install
  1. lucaspenney08 says:

    Thanks! It works great!

  2. Some Guy On The Internet says:

    I really, really, REALLY, did not expect that to work. Just the number of dependencies. The fact the branch is light years old. Would of made me thought running those commands would generate many screens of errors. But to my amazement… A code base that still runs. Today is a good day. You may have just saved me hours. Thanks a lot 🙂

  3. Alexandre says:

    Thanks guys!

    I takes some time to write down all the line commands, but it work!

    Best pygame installation reference.

  4. You’re missing one dependency for Xubuntu 16.04: python3-setup tools. Please see my comment below this answer here:

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s