Installing the Windows 64-bit Version of Pygame

UPDATE: Apparently, this is no longer necessary. As of February, 2017, you can just run pip install pygame and it will install the right version of pygame for your environment. (Thanks, Chek Wei).

I’m not a game developer, but I’ve been playing with Pygame lately and have been impressed. I plan to use it in one of our Python courses to teach object-oriented programming. I use 64-bit Windows 8, so I have the 64-bit version of Python 3.4. Most of our students are unlikely to be game developers, but because games have obvious visible objects, they provide a nice framework for teaching OOP.

Unfortunately, Pygame doesn’t have an official 64-bit installer, so they recommend you use the 32-bit version of Python. So, I installed the 32-bit version of Python alongside the 64-bit version I already had, but that was a pain as I had to constantly make sure I was running the right one. It also made the 32-bit version the default.

Luckily, Christoph Gohlke of the University of California, Irvine has made a bunch of 64-bit binaries available for Python extension packages, including one for pygame.

The installation file is a wheel file, which can be pretty tricky to install. The documentation is a bit weak, so I’ve laid it out here.

Note that these instructions assume you already have a 64-bit version of Python installed.

To install the Windows 64-bit version of Pygame, which is the only version that will work with the 64-bit version of Python, follow these steps:

  1. Make sure that your Path variable includes both your Python directory and the Scripts directory:

    add-python-to-path
    (Click image to enlarge)
  2. Go to http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame
  3. Click pygame 1.9.2a0 cp34 none win_amd64.whl (for Python 3.4):
    pygame-64-download
  4. Save the file locally. Do not rename the file as the file name structure is important.
    pygame_whl
  5. Wheel (.whl) files are installed using pip and wheel. So before installing the wheel file, you need to make sure you have an up-to-date version of pip and of wheel. To do this:
    1. Click the Windows icon and select Run:
      windows-run
    2. Type “cmd” in the Run prompt and press OK:
      cmd
    3. PIP is used to unpack wheel files. At the prompt, type “python -m ensurepip”:
      ensurepip
    4. If it tells you the requirement is already satisfied, run the upgrade command: “python –m ensurepip –upgrade”:
      ensurepip-upgrade
    5. Install wheel. At the command prompt, type “pip install wheel”:
      install-wheel
    6. If it tells you the requirement is already satisfied, run the upgrade command: “pip install wheel –upgrade”:
      upgrade-wheel
  6. Now you’re ready to install pygame 1.9.2a0 cp34 none win_amd64.whl. At the command line, make sure you’re in the same directory as the .whl file and then type “pip install pygame-1.9.2a0-cp34-none-win_amd64.whl”:

    If you get an error saying the file name does not exists, it’s likely because you’re running the pip install command from a different directory. Either use navigate to the correct directory (reference) and run the command again or run the command using a full absolute path (e.g., “pip install c:\users\nat\pygame-1.9.2a0-cp34-none-win_amd64.whl”).

Have fun making games with pygame!

About Webucator

Webucator provides instructor-led training to students throughout the US and Canada. We have trained over 90,000 students from over 16,000 organizations on technologies such as Microsoft ASP.NET, Microsoft Office, Azure, Windows, Java, Adobe, Python, SQL, JavaScript, Angular and much more. Check out our complete course catalog.


15 thoughts on “Installing the Windows 64-bit Version of Pygame”