Skip to main content

CompileWindows — wiki

Compile pygame on windows

There are three steps.

  • Get a C/C++ compiler.
  • Checkout pygame from github.
  • Run the pygame install commands.

Step 1, Get a C/C++ compiler.

These are the compilers you'll need.

These will download the required dependencies and build for SDL2(experimental) or SDL1.

Step 2, Checkout pygame from github.

To get pygame from github, you might need to install git. This is a good command line option for git checkouts on windows. https://gitforwindows.org/

Here is the pygame github repo where the code lives. https://github.com/pygame/pygame

Step 3, Run the pygame install commands.

SDL1 instructions.

git clone https://github.com/pygame/pygame.git
cd pygame
pip install setuptools requests -U
python -m buildconfig
python setup.py install
python -m pygame.examples.aliens

SDL2 instructions.

git clone https://github.com/pygame/pygame.git
cd pygame
pip install setuptools requests -U
python -m buildconfig -sdl2
python setup.py install
python -m pygame.examples.aliens

More information

Compiler information pages for windows.

old instructions

There are here for historical interest.

The incomplete guide with mingw is here: Compiling with MingW gcc on windows.

The incomplete guide with the Visual Studio 2003 Toolkit compiler is here: Compiling with the Toolkit Compiler.