问题
I have been trying to get this to work for days now, with no luck. All of the installation walkthroughs I can find either talk about pygame on mountain lion with python 2.x, or pygame with python 3 on osx 10.6, but never all 3 together.
Sorry if this is long, but here's what I've tried so far...
First I tried using homebrew and pip, following this: http://florian-berger.de/en/articles/installing-pygame-for-python-3-on-os-x
But I got the same errors mentioned here: Error when Installing Pygame on Mountain Lion
So, having made the modification suggested in the answer to that question, I tried to compile pygame from source, following pygame.org's directions for mountain lion: http://www.pygame.org/wiki/MacCompile (However, those instructions require NumPy, which I couldn't get because as far as I can tell it doesn't exist for python 3)
But the furthest I could get with trying to compile it like that was:
In file included from src/imageext.c:51:
/Library/Frameworks/SDL_image.framework/Versions/Current/Headers/SDL_image.h:27:21: error: /Library/Frameworks/SDL.framework/Versions/Current/Headers/SDL/SDL.h: Too many levels of symbolic links
/Library/Frameworks/SDL_image.framework/Versions/Current/Headers/SDL_image.h:28:29: error: /Library/Frameworks/SDL.framework/Versions/Current/Headers/SDL/SDL_version.h: Too many levels of symbolic links
/Library/Frameworks/SDL_image.framework/Versions/Current/Headers/SDL_image.h:29:28: error: /Library/Frameworks/SDL.framework/Versions/Current/Headers/SDL/begin_code.h: Too many levels of symbolic links
/Library/Frameworks/SDL_image.framework/Versions/Current/Headers/SDL_image.h:136:28: error: /Library/Frameworks/SDL.framework/Versions/Current/Headers/SDL/close_code.h: Too many levels of symbolic links
src/imageext.c: In function ‘PyInit_imageext’:
src/imageext.c:675: warning: implicit declaration of function ‘PyCObject_Check’
src/imageext.c:675: warning: implicit declaration of function ‘PyCObject_AsVoidPtr’
error: command '/usr/bin/gcc' failed with exit status 1
And newbie that I am, I don't know what to try next. (Yes, I have googled. All I could determine is that I have some kind of symlink loop(s), but what/where and how to fix it I don't exactly know.)
If there is some ridiculously easy fix to this that one of you smart people can point out to me... that would be GREAT (even if it makes me feel like an idiot!)!
Failing that, alternate strategies?? All I want is to use pygame with python 3 on mountain lion... if anyone has done this, I would LOVE to hear how!
P.S. I'm obviously new here, and just learning to code... please explain things to me as if I were a 5-year-old. Seriously. :)
回答1:
I got the same problem. I just created an SDL folder and copied sources files into it.
So instead of:
ln -s SDL .
go:
mkdir SDL; cp *.h SDL
It's ugly, but it works.
来源:https://stackoverflow.com/questions/12362449/pygame-for-python-3-on-osx-mountain-lion