…little BITS of our lives.


Okay, so I struggled for about an hour trying to get ‘ pygame ‘ run with Python 3 on my ubuntu 11.04 machine, so I decided to write a post about it.
By default, Ubuntu ships with Python 2.7 installed, so pygame gets installed with python 2.7.
To install it with python3, do the following:
1. Open up the terminal and type the following code:
sudo apt-get install python3-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsdl1.2-dev libsmpeg-dev python-numpy subversion libportmidi-dev
2. Then once all libraries are downloaded and installed, type:
svn co svn://seul.org/svn/pygame/trunk pygame

cd pygame

python3 setup.py build

sudo python3 setup.py install

3. That’s all! You can now run pygame with python3.

I have also updated this on the pygame website, so that no one falls into this trouble again! πŸ˜‰

Comments on: "Installing Pygame with Python 3.2 on Ubuntu 11.04" (22)

  1. I have been searching all over for this answer!! Thanks for putting this together.
    btw…Im running Ubuntu 11.10 and it still worked just fine.

    Python 3.2.2 (default, Sep 5 2011, 22:09:30)
    [GCC 4.6.1] on linux2
    Type “copyright”, “credits” or “license()” for more information.
    >>> import pygame
    >>>

  2. Hi just wanted to thank you for pointing me into the right direction, but I ended up with an error (might be because I was using Ubuntu 11.10), have a look at this page to see the slightly reworked solution that worked for me.

    http://forums.oreilly.com/topic/20635-confusion-with-installing-pygame-and-python-3/page__view__findpost__p__39168

    commands I used for python 3.2:

    sudo apt-get install python3-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsdl1.2-dev libsmpeg-dev python-numpy subversion libportmidi-dev

    cd /usr/local/lib/python3.2/dist-packages/

    sudo svn co svn://seul.org/svn/pygame/trunk pygame

    cd pygame

    sudo python3 setup.py build

    sudo python3 setup.py install

  3. I like to say the libavformat-dev, libswscale-dev are also needed depencies for pygame on the 3.2 build

  4. Not sure what the dependencies of numpy are but you will also need it installed on your 3.2 build for it function correctly. The steps are very similar to install it, except you use a git repository instead of svn. It installed without complaining about any missing depencies like last time. So I’m assuming I already I had them.

  5. gabirobs said:

    I’ve done the steps on Ubuntu 11.10 and it works.
    thank you so much for the tips. πŸ˜€

  6. Very useful, many thanks!

  7. Great, it also works on my raspberry pi.
    Kernel: Linux raspberrypi 3.2.27+ (original element14 OS)

  8. using 12.04 works perfectly thanks a lot πŸ˜€

  9. John Greyman said:

    Wow, thanks alot. Even with this it took me half an hour to get everything up and running ^^;
    You missed a few dependencies, so I had to find this and it improved the number I had, though it doesn’t include the Jpeg and something else.

    sudo apt-get install mercurial python3-dev python3-numpy ffmpeg \
    libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsmpeg-dev \
    libsdl1.2-dev libportmidi-dev libswscale-dev libavformat-dev libavcodec-dev

    • Hi John,
      Glad that you finally got it working. Thank you for providing a more complete list of dependencies, gl with ur pygame adventures πŸ™‚

  10. This has been great help! I don’t know how I’d ever be able to figure out how to install Pygame without finding this post. Again, you’ve been a great help to newbies. ^-^

  11. Thank you so so much, i can finally run pygame without windows πŸ˜€

  12. If you like any combination of your computer, your sanity, or the very concept of computer programming, don’t try that in Mint.

  13. worked also in debian jessie and ubuntu 15.10
    thanks a lot !!

Leave a reply to Death_Cult_667 Cancel reply