Question

My question is similar to

Installing Pygame for Mac OS X 10.6.8,

unable to import pygame, and

Pygame for Python 3.2 on mac - import error.

When I try to import pygame *, I get ImportError: dlopen(/Library/Python/2.7/site-packages/pygame/base.so, 2): Library not loaded: @executable_path/../Frameworks/SDL.framework/Versions/A/SDL Referenced from: /Library/Python/2.7/site-packages/pygame/base.so

I'm trying to figure out whether or not it applies to my system. I don't remember how I installed pygame, but if I do port search pygame, I get

py-game @1.9.1 (python, devel, multimedia, graphics)
py24-game @1.9.1 (python, devel, multimedia, graphics)
py25-game @1.9.1 (python, devel, multimedia, graphics)
py26-game @1.9.1 (python, devel, multimedia, graphics)
py27-game @1.9.1 (python, devel, multimedia, graphics)
py31-game @1.9.1 (python, devel, multimedia, graphics)
py32-game @1.9.1 (python, devel, multimedia, graphics)

My hunch was that port install py32-game would fix the issue, but It doesn't change anything (maybe python needs to somehow point to a different version of pygame?). Does anyone have experience with my particular config? It's unclear to me how to ascertain which version of pygame I need to be running.

OSX 10.7.5 Python 2.7.3

Was it helpful?

Solution

AFAICT, It turned out to be two issues:

  1. pygame needed to be installed again after I switched python versions from the OSX native version to the ports version of 2.7 (I uninstalled the macports version)

  2. my .bash_profile path was messed up and I needed to export the correct locations to the newly installed version so that python could find what it needed

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top