In most situations, the easiest way to get pygame is to install a pre-built wheel, by running:
pip install pygameWheels are available for x86 and x64 architectures on Linux and Windows, and for x64 on Mac. If pip doesn't find a wheel for your platform, it will try to compile pygame from source (see below).
Pygame requires Python; if you don't already have it, you can download it from python.org.
Unix Binary Packages
Many Linux and BSD distributions have their own packages of Pygame. These may have an older version of Pygame than the wheels, but have been carefully tested with other packages in that distribution.
FreeBSD also has an active pygame package. While techinicaly it isn't binary, it is automatically built and installed by the ports manager. See the FreeBSD package page for more information. http://www.freebsdports.info/ports/devel/py-game.html
Gentoo has a builtin package for pygame. This is compiled for your system as it installs, similar to BSD, http://packages.gentoo.org/package/dev-python/pygame
Installing From Source
Compiling and installing pygame is handled by Python's distutils. Pygame also comes with some scripts to automatically configure the flags needed to build pygame. Use the "setup.py" script to start the installation.
The first time you run the setup script, it will call the "config.py" script. This will build a "Setup" file which stores all the information needed to compile. The "config.py" will do a good job of detecting what dependencies are available and where they are located. If it isn't perfect, it is easy to build your own, or edit the created "Setup" text file. This "Setup" file is a simple Makefile-like text file. It defines variables needed to use each dependency, and then enables all the pygame modules with found dependencies. If you have trouble compiling, you should be able to easily fix any problems inside the "Setup" file.
Running the "setup.py" script will call distutils to build and install the pygame package. Distutils actually supports a wide variety of compile and install options. running "python setup.py help" will start to show you the different options available. You can change many things like install locations, compiler to use, and more. Calling the "setup.py" script with no arguments and it will just ask you if you want the default flags needed to compile and install.Windows Compiling Info
Unix Compiling Info
Mac OS X Compiling Info