Installing Pygame for Mac OS X 10.6.8
Solution 1
The Python 2.7.3 .dmg Mac OS installer installs both 64-bit and 32-bit binaries in:
/Library/Frameworks/Python.framework/Versions/2.7/bin/
There is a 32-bit binary called python2.7-32
in that folder.
To use it in the Terminal simply type $ python2.7-32
instead of python
To use it in IDLE simply rename the 64-bit python2.7
binary to something like python2.7-64
then rename python2.7-32' to
python2.7` and next time you launch IDLE or the Terminal it will use the 32-bit binary. Change it back when you are done.
You can also force launch IDLE in 32-bit mode from the Terminal:
$ arch -i386 /Library/Frameworks/Python.framework/Versions/2.7/bin/idle2.7 -n
You can create a shell script Automator application to make it easier to launch.
Solution 2
The clue is in the last line no matching architecture in universal wrapper
. Most likely you are using precompiled 32-bit binaries on a 64-bit system.
You can try reinstalling or compiling from scratch but it would probably be far easier to just force python to run in 32-bit. Lots more info over here in this post.
user1064913
Updated on August 25, 2021Comments
-
user1064913 over 2 years
Using Python 2.7.2. When I try to import pygame I get this error message:
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/__init__.py", line 95, in <module> 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'm not exactly sure what this means. Should I compile pygame myself?
-
user1064913 over 12 yearsAlright I changed to 32-bit but now it's saying that the module pygame does not exist.
-
Kyle G over 12 yearsDid you try reinstalling PyGame after changing the architecture? Also, you probably already know this but make sure you've used the right module name and capitalization by checking
>>> help('modules')
. -
user1064913 over 12 yearsYes, I've tried reinstalling it. It doesn't show up in the modules list. I think python changes back to 64-bit after I exit python in the terminal. Is there a way to change it to 32-bit mode permanently?
-
Kyle G over 12 yearsYou could try an alias
alias python='arch -i386 /usr/bin/python2.6'
other than that, maybe a compile for 64bit? don't know if that will work but might be worth a shot... -
christianbrodbeck over 12 yearsHave you checked your PYTHONPATH? When I installed pygame with the installer from the site it was installed at a non-canonical location ('/Library/Python/2.7/site-packages')
-
benlong about 11 yearsrun python2.7-32 fixed my issue
-
C. Sederqvist over 10 yearsWell, off course. The version of Python you downloaded was 32-bit, so why wouldn't it work? This is not a solution, but a "one step forward - two steps back" workaround...
-
Patrick Roberts about 7 yearsDownloaded installer fails with error "There was no software found to be installed"