I want to install pygame on Mac 10.6.8.
I managed to install python 2.7.9 and to make it stable.
I tried to install different versions of pygame but none worked: for example with the 1.9.1 it gives me this error:
Output:
Traceback (most recent call last):
File "/.../Desktop/example.py", line 1, in
import pygame
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/__init__.py", line 95, in
from pygame.base import *
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so, 2): no suitable image found. Did find:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so: no matching architecture in universal wrapper
I don't know if it is a problem of computer architecture (32/64 bit) or because the versions of python and pygame do not match.
I tried to look further in the official site of pygame but did not solve a thing.
Did anyone have the same problem? How to solve it?
Please note that I have already taken a look at other similar questions on stackoverflow.
解决方案
The solution for me, after a lot of searching, is described in this link, using homwbrew and pip.
install XQuarts if not already installed from the site
install homebrew (link here)
install python3 with the command brew install python3 in the terminal
install the Mercurial version control system: brew install mercurial
do the same for the git version control system, which is needed by a dependency package: brew install git
Now install all the dependencies of Pygame: brew install sdl sdl_image sdl_mixer sdl_ttf smpeg portmidi
install pip with the command /usr/local/share/python3/easy_install pip (in my case the folder was /usr/local/Cellar/python3/3.4.3_2/bin)
/usr/local/share/python3/pip install hg+http://bitbucket.org/pygame/pygame