Using Python 2.7.2. When I try to import pygame I get this error message:
Traceback (most recent call last):
File \"\", line 1, in
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.
I was having the same problem. I had Python 2.7.2, the installation version for OSX 10.6. Here is what I did to fix it:
1) Deleted my current installation of Python, both from the applications folder and from /Library/Frameworks/Python.framework (I just deleted 2.7.2, left 3.2 alone)
2) Reinstalled Python 2.7.2, the installation version for OSX 10.3 (my pygame installation file was labeled for OSX 10.3, which prompted me in this direction)
3) Reinstalled pygame
Now pygame imports without throwing an error.
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.
If you don't want to mess with system file then the easiest way is reinstalling Python 2.7.2 but the 32-bit version only. Get it here.
The dmg that includes both 64/32 bits is causing this mess.
What I'd recomend is using a decent Python IDE, like PyCharm.
I've installed both the 3.3(x64), 3.3(x86) and the 2.7.6 from python.org with both architectures included.
All I have to do is to set up an interpreter configuration for each and I can pick and choose on a project by project level.
For me this is the definite way of smooth Python Development, contra Python Mangling and manual workarounds.
The Community Version of the PyCharm IDE is even free as in beer! Go get it over at JetBrains Site
It's a breeze to use and behaves the same across both Windows, Linux and OS X. It also acts as a package manager, so you can install different components straight from the IDE and run Console sessions using different configurations. It also lets you set up virtualenv's easily.
Enough propaganda! Go try it out yourself instead.
And yes, I got PyGame working using this approach...