Best way to install pygame on OS X Lion?

2019-01-25 05:23发布

问题:

I tried to install pygame via pip but this fails. Based on my google searches, it sounds like easy_install also fails.

I also checked out: http://www.pygame.org/wiki/MacLionCompile but the solution is incomplete.

I'm running python 2.7.1 bundled with Lion.

Suggestions? Appreciate the help.

回答1:

You could try the binary package for Lion, available on the pygame website.

It worked for me (OSX 10.7.1 with bundled Python 2.7.1)



回答2:

See the answer from this question: PyGame in a virtualenv on OS X with brew?

Essentially, the PyGame in PyPy hasn't been updated for a while. The version in the repository has updated build scripts that handle Pythonbrew, virtualenv and other utilities.

The pip command to use is:

pip install hg+http://bitbucket.org/pygame/pygame


回答3:

Just for the sake of anyone that googles this question, my lab has a wiki set up with instructions for installing Pygame with just about any configuration:

http://smash.psych.nyu.edu/labwiki/PyGameSetup



回答4:

I had good luck with macports:

  1. Install macports if you don't already have it: http://www.macports.org/
  2. Install python via macports: sudo port install python26. I typed in the command it said at the end to set it as my default python installation. If you don't, then in step 4 you'll have to run the app a different way.
  3. Install pygame: sudo port install py26-game
  4. Run your pygame app: python main.py


回答5:

I have been looking for this for myself and I stumbled upon this build that happens to work. I am using OSX 10.8.3 and python 2.7.

http://inside.catlin.edu/moodle/mod/resource/view.php?id=16736



标签: python pygame