How to install Pygame

Installing Pygame takes one pip command once Python is set up. Pick your operating system for step-by-step instructions and fixes for the usual snags.

Guides

Windows

Python, the py launcher and pip on Windows 10 and 11.

macOS

python.org or Homebrew Python, venv and pip on Macs.

Linux

pip in a venv, or your distribution's package.

The short version#

  1. Install Python 3 from python.org (or your system's package manager).
  2. Open a terminal and run python -m pip install pygame (use py on Windows or python3 on macOS and Linux if python isn't found).
  3. Test it with python -m pygame.examples.aliens.

If anything goes wrong, the guides below explain each step for your system, and the troubleshooting section covers specific error messages.

pygame or pygame-ce?#

Both install the same import pygame module and both work with every tutorial on this site. pygame-ce, the community edition, releases more often and usually supports new Python versions sooner. Install one or the other in a given environment, never both. Compare them.

Can't install anything?#

School and work computers often block installations. Pygame Online runs Pygame code in your browser with nothing to install, and most beginner examples work there unchanged.

↑ ↓ to moveEnter to openEsc to close