Webucator Blog

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!


  • Bill

    Thanks! I am an old guy (73) who had fun writing programs in early basic languages (many inspired by Scientific America Computer Recreations). Now that I am retired from work and cruising on our sailboat, I feel the urge to have some more fun with computers. I am completely self taught, so your perfectly clear instructions made it easy to deal with what otherwise would be a very tiresome research project.
    Cheers!
    Bill

  • Yogesh

    Great post:) it worked for me

  • Chazetoh

    Doesn’t work when i try “python -m ensurepip” . it says “python” isnt recognize as an internal or eternal command.
    Help!

    • Ashish Roy

      I am also facing the same problem. help !!

  • Geoff

    Like Bill I’m retired and I’m playing with Python as light relief after a career in databases. I’ve been struggling to install pygame for days and yours were the instructions that worked. I’m very grateful.

  • Carlos

    Extremely helpful! Thanks a lot!

  • 6/12/2015 – john
    Does not work on win7 64 bit. Followed all instrux to the letter, including path checks and upgrades. ALL OK until ‘pip install pygame….’ (checked rechecked). Install fails with messages:
    “Requirement ‘pygame-1.9.2a0-cp34-none-win_amd64.whl’ looks like a filename, but the file does not exist.” then quotes the supposed filename again and exits.
    I think the problem here is that you have not told us ‘where’ to save the wheel file. You say just ‘save the file locally’, which to me means nothing intelligible. So I saved it where ‘I’ wanted. Perhaps you have a ‘save’ mechanism that puts it in someplace special. I do not, on win7.

  • OK – still fails after I:
    copied the file (NOT renamed, checked again against your quoted filename above) to 1) C:/Python34, and then to 2) C:/Python34/scripts.
    The pip install still fails.
    I did not include the final line in the error message, which is “pygame…etc (exactly as quoted above) is not a supported wheel on this platform”.
    Again, I am running win7 64 bit, Home Premium.
    Also, I am running all these commands as administrator.
    Would appreciate any suggestions, but: A common suggestion elsewhere online is to deinstall python and downgrade. That is not something that is worth doing, for me.

  • OK – 3rd and final post:
    The problem with this particular install (64 bit) for me is that I am ‘not’ running 64-bit python 3.4.3, but the 32-bit version on my 64-bit system.
    However, the latest 32-bit pygame does not work either, as is the case with quite a few others online, I see. Obviously there are unresolved problems between python and pygame, which makes pygame useless for many people, including me.

  • OK – success!
    RE: my three posts above, today, 6/12/2015.
    Finally got pygame-1.9.2a0… to install OK using above instructions. Problem was that I did not have python343 64 bit installed to begin with (had 32-bit). When I uninstalled python and reinstalled using the 64-bit amd installer, then installed pygame 64 as above, everything worked.
    BUT – apparently running the 32-bit python on my 64-bit system, and trying to install 32-bit pygame, does not work.
    Hope this may help someone else with similar problems.

    • Glad you got it working, John! Thanks for sharing.

  • dyrkabes

    Thanks for such a detailed tutorial, it really helped A LOT!

    • You’re very welcome, @dyrkabes:disqus. Glad to hear it!

  • Hrishikesh Waikar

    Thanks Nat ,you solved my problem….!