Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing PyGame onto Mountain Lion OS

Okay, so I've completely given up.

I've tried about a thousand different walkthroughs to solve my problem, on every website I can find, but I either get stuck and no one knows the answer, or they just don't work.

So has anyone got an answer to installing PyGame onto Mountain Lion that they know 100% works and they can walk me through it as if I'm 6 years old?

I just want to run PyGame and this is driving me insane.

Cheers.

like image 222
user6988001 Avatar asked Mar 29 '13 16:03

user6988001


People also ask

Can you install pygame on Mac?

Pygame is a set of Python modules used for writing simple video games and graphical programs. It is cross-platform, which means it can be installed on both Windows and Mac computers.

Can you install pygame on Linux?

For Linux, open a terminal and run " sudo apt-get install python-pygame ". If nothing appears after you hit the Enter key, then you know Pygame has successfully been installed. If the error ImportError: No module named pygame appears, then try to install Pygame again (and make sure you typed import pygame correctly).

What is pygame compatible with?

Truly portable. Supports Linux (pygame comes with most main stream linux distributions), Windows (95, 98, ME, 2000, XP, Vista, 64-bit Windows, etc), Windows CE, BeOS, MacOS, Mac OS X, FreeBSD, NetBSD, OpenBSD, BSD/OS, Solaris, IRIX, and QNX.


2 Answers

Ok, I'm running OSX 10.8.3 (Python 2.7.3), and I got pygame (1.9.1) up and running in about 15 minutes.

Here's what I did. I brewed my Python a long time ago, so I forget the steps there. I seem to remember editing some symbolic links in \usr\local. At any rate, I'll assume you can use google as well as I can to figure out what to do here.

  1. download homebrew
  2. brew install python27 if you don't have it
  3. pip install numpy if you don't have it.
  4. brew install sdl
  5. brew install sdl_gfx sdl_image sdl_mixer sdl_ttf
  6. Download pygame v1.9.1 source for Unix architecture.
  7. cp ~/Downloads/pygame-1.9.1release.tar.gz /tmp/pygame-1.9.1.tar.gz` or wherever. Go to that directory.
  8. sudo tar -xvf pygame-1.9.1.tar.gz
  9. sudo python config.py should fail with a hint to edit Setup
  10. sudo emacs Setup, or your favorite text editor.
  11. Look for the entries for SDL, FONT, IMAGE and MIXER.
  12. Replace them with SDL = -I/usr/local/include/SDL -L/usr/local/lib -lSDL, FONT = -lSDL_ttf, IMAGE = -lSDL_image, and MIXER = -lSDL_mixer, respectively.
  13. cd src, emacs scale_mmx64.c. Look for all occurrences of movsxl with movslq. You should find two occurrences.
  14. cd .. and sudo python setup.py install

I only checked that I can load pygame from the prompt in Python, I didn't check anything else.

Refs:

http://jalada.co.uk/2011/06/17/installing-pygame-on-os-x-with-a-homebrew-python-2-7-install.html Error when Installing Pygame on Mountain Lion

like image 160
BenDundee Avatar answered Nov 05 '22 09:11

BenDundee


If you have MacPorts installed, you can run sudo port install pyXX-game where XX is your macports python version from 24 to 27 and 31 to 32. This way it'll take care of all your dependencies automagically, and should theoretically work out of the box, assuming your system is set up to use macports python by default.

like image 25
MattDMo Avatar answered Nov 05 '22 07:11

MattDMo