How To Download Pygame On Mac

May 07, 2014  How to install Python3 + Pygame on mac os x - Mac computer GadgetHero. Mac vs PC - ROLE REVERSAL. Installing Python 3 and Pygame on OS X / Mac Platform - Duration.

How To Download Pygame On Mac
  1. Open the Terminal.
  2. Install Homebrew.
  • 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)'
  1. 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.
  1. Install prerequisites for pygame: brew install sdl sdl_image sdl_mixer sdl_ttf portmidi mercurial
  2. Install pygame using pip with pip install hg+http://bitbucket.org/pygame/pygame
  3. 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.

Example

On windows

  1. Navigate to http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame – an unofficial site providing windows binaries of open-source python packages for the official CPython distribution by Christoph Gohlke.

  2. Download the appropriate pygame .whl file according to your installed python version. (The file is named something like pygame -<pygame version> - <python version>- win32.whl)

  3. Run

    inside your terminal, bash or consol.
    Note: if pip is not found in PATH try to run python -m pip install your-pygame-package.whl

  4. Check if you can import pygame as a python module

    If you do not get an error, you have correctly installed pygame on your computer :)

On linux

  1. Open your terminal and run

    Note: This will install pygame for python2

  2. Try to import pygame inside

    If you do not get an error, you have correctly installed pygame on your linux system :)

On macOS

There are two ways to install it on mac:

Method 1

Pygame Download For Python 3.7

Go to the Pygame downloads page and download the mac installer. Run it, and it should install Pygame on your Mac.

Method 2

Install Homebrew:

Install Pygame On Mac

Pygame download for python 3.7

Then use Homebrew to install Python 2.7.12 and Pygame:

Now run Python in your terminal and try import pygame. If it does not say anything, it's installed successfully.


Pygame For Python 3.6

Related Tags