Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

I am using Ubuntu 13.10.I have both python 2.7 and python 3.3.I have installed pygame properly in python 2.7.How can i install it in python3.3.Does pygame support python3.3 or not?

share|improve this question
sudo apt-get install python-pip; sudo pip install pygame ? – Gustaf Jan 8 '14 at 14:24
@Gustafpython3-pip and pip3 should be used – warvariuc Jan 18 '14 at 10:56

3 Answers 3

up vote 7 down vote accepted

Here's a link to a solution for Ubuntu 12.04. Hope it helps. From the terminal:

  1. Change to your home directory.

    cd ~
  2. Get Pygame source code.

    sudo apt-get install mercurial
    hg clone
    cd pygame
  3. Install dependencies.

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

    python3 build
    sudo python3 install
share|improve this answer

Unfortunately you need to recompile it. And unfortunately the last stable version (1.9.1) doesn't support python 3...

So you need to download the last source code from the trunk, hopping it's not broken at this moment:

sudo apt-get install mercurial
hg clone

You also need to download the build dependency:

sudo apt-get build-dep pygame
sudo apt-get install python3-dev
sudo apt-get install python3-numpy

This will install dependency used by the version of pygame available on your package depot. Newer version maybe need other dependency! We also need to specify python3-dev and python3-numpy because, well, build-dep will install python2 version of this packages...

You can now run:

cd pygame

If some dependency are missing will list them and ask if you want to continue if this dependency are not mandatory. You can install them if you want/can or simply ignore it and probably loss some functionality.

Now it's time to build and install:

python3 build
sudo python3 install
share|improve this answer

The official build doc for python3 on ubuntu seem to be here.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.