- Open the Terminal.
- Install Homebrew.
- If you run into issues with OS X El Capitan, this will help.
- Enable the Xcode Command Line Tools, necessary for installing/compiling Homebrew:
xcode-select –install
- Then install Homebrew itself:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- Install Python 2.7 with
brew install python
- Optionally you can also install Python 3 with
brew install python3
- Installing either of these with install pip and pip3 respectively, a package manager for Python.
- Install prerequisites for pygame:
brew install sdl sdl_image sdl_mixer sdl_ttf portmidi mercurial
- Install pygame using
pip
withpip install hg+http://bitbucket.org/pygame/pygame
- Install numpy and matplotlib using
pip install numpy matplotlib
Then you can run Python scripts from the Terminal with python filename.py
.
Why use Homebrew? So when you install things you can easily remove and reinstall them if they break, remove them if they're misbehaving or you no longer need them, or update your packages whenever updates come out (you can do that with brew update
then brew upgrade
). It also makes installing all kinds of languages and things super easy.
I install all pygame follow all steps, but I got error like that