How To Download Pygame On Mac

Posted : admin On 11/2/2019

How to install PyGame for Python 3 PyGame is a set of python modules designed for writing games. It uses the SDL library to allow you to create games and multimedia programs in Python. Jun 13, 2018  Installing Python and Pygame for Mac Zenva. Unsubscribe from Zenva? Download & Install Pygame for Python 3.7+ Using the Pip Package - Duration: 4:30.

  1. Pygame Install Windows
  2. Pygame Download For Python 3.7
  3. 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.

Pygame Install Windows

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:

How To Download Pygame On Mac

Pygame Download For Python 3.7

Method 1

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: Dmg extractor.

How to download pygame on mac

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.


How To Download Pygame On Mac

Related Tags