5

I have installed pygames on my mac, using the installer in the following package found on the pygame.org site: pygame-1.9.1release-python.org-32bit-py2.7-macosx10.3.dmg.

I have installed python with the Python 2.7.2 Mac OS X 64-bit/32-bit x86-64/i386 Installer found on python.org, and ran easy_install pyobjc so that I now have pyobjc 2.2 installed.

But when I try the to import pygame in the repl, I get this:

>>> import pygame
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
bigblind
  • 12,539
  • 14
  • 68
  • 123

2 Answers2

3

This was a 32 bit vs 64 bit issue for me. I followed the directions listed here: http://web.mit.edu/6.090/www/pygame.html and the issue was resolved.

ErikTX
  • 31
  • 2
  • 2
    I am also unable to import pygame, but it just say 'ImportError: No module named pygame'. Could that also be 32b vs 64b issue? Python 2.7.8 |Anaconda 2.0.1 (64-bit); Ubuntu 14.04 I used 'sudo apt-get install python-pygame', and that appeared to work. I tried clicking your link now, but it is dead. – PaulMag Oct 22 '14 at 21:23
3

I admit this is a guess, but could this be a 32 vs. 64 bit issue?

If I do:

file /usr/bin/python

I get:

python: Mach-O universal binary with 2 architectures
python (for architecture x86_64):   Mach-O 64-bit executable x86_64
python (for architecture i386): Mach-O executable i386

Wondering what you see on your add-in file?

For example, if it's 32 bit, then run Python that mode:

arch -i386 /usr/bin/python

If that's not exactly it, at least this will hopefully get you in the right direction.

Mark Bennett
  • 1,446
  • 2
  • 19
  • 37
  • Yes, this is almost certainly a 32 bit vs. 64 bit issue. Are you sure you installed the correct PyGame for your system? – geometrian Feb 16 '12 at 19:52