Arthur Silva
Arthur Silva

Reputation: 150

Python2 Pygame Installation Problems OS X

At first I was getting an error of 'no module pygame', then I've installed pygame using pip and when I run my program I get this error:

[1]    60751 illegal hardware instruction  python pyman.py
[1]    1521 illegal hardware instruction  python pyman.py

At first error I thought that pygame would not run on OS X, and than I tried to reinstall it using pip.

Requirement already satisfied (use --upgrade to upgrade): pygame in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages

SDL is installed:

Warning: sdl-1.2.15 already installed
Warning: sdl_image-1.2.12_3 already installed
Warning: sdl_mixer-1.2.12 already installed
Warning: sdl_ttf-2.0.11 already installed
Warning: portmidi-217 already installed

I'm using a Mac OS X El Captain, Python 2.7.12 and

Could you enlight me? Thanks!

Upvotes: 2

Views: 141

Answers (1)

Sai prasant
Sai prasant

Reputation: 50

Installing pygame is not straight forward in mac. Try these set of instructions:

Create and add the following to ~/.bash_profile: # Homebrew binaries now take precedence over Apple defaults export PATH=/usr/local/bin:$PATH

Install Apple Xcode command line tools: xcode-select --install

Install XQuartz: http://xquartz.macosforge.org/landing/

Install homebrew: ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

Install Python3 "proper" and packages we’ll need for installing PyGame from bitbucket: brew install python3 hg sdl sdl_image sdl_mixer sdl_ttf portmidi

Install PyGame: pip3 install (get the pygame link from github) (I don't have enough reputation to post more than 2 links, I hope you understand)

Restart the Mac for Quartz changes

It worked for me. I hope it helps :)

Upvotes: 2

Related Questions