Technology Software

How to Install Pygame With Python 2.7 on a Mac

    Download and Installation

    • 1
      The electronic version of this game is a popular programming assignment.BananaStock/BananaStock/Getty Images

      Open the terminal application and confirm that you have Python version 2.6 or greater. At the terminal prompt, type "Python." The result should look something like this:

      My-MacBook-Pro:~ pna1$ python

      Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49)

      [GCC 4.2.1 (Apple Inc. build 5646)] on darwin

      Type "help," "copyright," "credits" or "license" for more information.

      >>>

      Exit Python by typing "exit()" at the Python prompt. Quit the terminal application.

    • 2
      Download and installation take little time.Stockbyte/Stockbyte/Getty Images

      Visit the Pygame website and download the Pygame distribution appropriate for your version of OS X and Python. Double-click the downloaded file to unzip it, then double-click the installer program. Follow the instructions for installing Pygame.

    • 3). Open the terminal window. Initiate a Python session by typing "Python" at the terminal prompt. Load the Pygame libraries and modules by typing "Import Pygame" at the Python prompt. It should look something like this:

      My-MacBook-Pro:~ pna1$ python

      Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49)

      [GCC 4.2.1 (Apple Inc. build 5646)] on darwin

      Type "help," "copyright," "credits" or "license" for more information.

      >>> import pygame

      >>>

    • 4
      You now have the green light for Python game programming.Ryan McVay/Photodisc/Getty Images

      Initialize Python by typing "Pygame.init()" at the Python prompt. Your terminal window should look like this:

      >>> pygame.init()

      (6, 0)

      >>>

      You are now ready to use Pygame in your Python game-programming projects.

Leave a reply