0

I am using a mac and i want to use pygame but it is not working. this is the error i get when I try to do import pygame

Traceback (most recent call last):
  File "<pyshell#6>", line 1, in <module>
    import pygame
  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

Please help I am using python 2.7.9

  • 1
    Can you provide more detail? Like how do you install `pygame` and are all the files are at correct path? – SSC Jan 28 '15 at 01:54
  • @SCC I went to the pygame website and downloaded pygame-1.9.1release-python.org-32bit-py2.7-macosx10.3.dmg 12MB – somebodyy Jan 28 '15 at 01:56
  • You are trying to install a 32-bit version of Pygame when you need 64-bit. Try following a guide [like this](https://jamesfriend.com.au/installing-pygame-python-mac-os-108-mountain-lion). I can't vouch for that particular guide as I'm not on a Mac and can't test it myself. – Marius Jan 28 '15 at 02:05
  • you can find the answer here: [installing-pygame-for-mac-os-x-10-6-8][1] [1]: http://stackoverflow.com/questions/8275808/installing-pygame-for-mac-os-x-10-6-8/10714442#10714442 – Eamon Jan 28 '15 at 02:20
  • @marius sorry but the guide didn't work, is there anyway to make this work – somebodyy Jan 28 '15 at 02:25
  • 1
    Pygame distribution is a mess, and only works any well on Windows (Where Christoph Gohlke has kindly provided prebuilt binaries.) On mac, I found the easiest way to get Pygame going was to install Homebrew, then install python and pygame with it. – Name McChange Jan 28 '15 at 03:09
  • What is homebrew @name mcchange – somebodyy Jan 28 '15 at 03:22
  • 1
    It's a package manager for mac. http://brew.sh/. If I recall correctly, I got python working by doing `brew install Homebrew/python` and then `brew install pygame` – Name McChange Jan 28 '15 at 03:43

1 Answers1

0

If your file name is called pygame.py the system imports your python file. If your file name is not pygame.py, you can try doing pip install pygame or python -m install pygame.

Zachary
  • 21
  • 3