Tausif.U
Tausif.U

Reputation: 11

How can I fix this error from pygame

I think I have downloaded pygame wrong. Whenever I try to import and initialize it I always get this error:

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

Can someone explain what this is?

Upvotes: 0

Views: 648

Answers (1)

Chris
Chris

Reputation: 898

It looks like you are trying to install Pygame against the OS X included version of Python. This is a bad idea for several reasons:

  1. It's old - the version that ships with OS X is an older 2.7 release.
  2. It's non-standard - Apple has modified it in un-obvious ways.
  3. You can't mess with it - you can break your OS X installation if you tinker with it.

For this reason, it is highly recommended that you set up a development environment with a separate, fresh install of Python. The easiest way to do this is with Homebrew, although you can download the installer from http://python.org as well.

While you're at it, I strongly recommend you use Python 3 (the current version is 3.6). There is no reason for a beginner to be using 2.7.

Once you have Python installed correctly, installing Pygame is as simple as:

$ pip3 install pygame

Upvotes: 1

Related Questions