How to Install Pygame on Windows 10

Pygame is a free Python library for making 2D games. On Windows 10 you install it with pip, Python’s package installer, in about a minute. Windows 10 reached end of support on October 14, 2025. Consumer Extended Security Updates (ESU) now run until October 12, 2027. The same steps work on Windows 11.

Quick Answer

Install Python, open Terminal and run py -m pip install pygame. Test it with py -m pygame.examples.aliens.

How to Install Pygame on Windows 10

  1. Install Python from python.org (the Python install manager is now recommended) or from the Microsoft Store.
  2. Open Terminal or Command Prompt.
  3. Check Python with py –version.
  4. Run py -m pip install pygame.
  5. Wait for Successfully installed pygame.
  6. Test with py -m pygame.examples.aliens. A small game window should open.
Terminal window installing pygame with pip and showing a successful install
pip downloads and installs pygame.

Useful Commands

Command Does
py -m pip install pygame Installs pygame
py -m pip install –upgrade pygame Updates it
py -m pip show pygame Shows the installed version
py -m pip uninstall pygame Removes it

Install Pygame in a Virtual Environment

For a real project, keep pygame in a virtual environment so it does not clash with other Python projects. In Terminal, go to your project folder and run:

  1. py -m venv .venv to create the environment.
  2. .venv\Scripts\activate to switch to it (your prompt shows (.venv)). If PowerShell refuses to run the script, run the same command in Command Prompt instead.
  3. python -m pip install pygame to install pygame inside it.

Run deactivate when you are done. In VS Code, select the .venv interpreter so the editor uses the same copy.

Write Your First Pygame Program

Save this as game.py and run it with py game.py. It opens a window and draws a yellow circle until you close it:

import pygame

pygame.init()
screen = pygame.display.set_mode((640, 480))
pygame.display.set_caption("My first game")
clock = pygame.time.Clock()
running = True

while running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False
    screen.fill((30, 30, 60))
    pygame.draw.circle(screen, (255, 200, 0), (320, 240), 40)
    pygame.display.flip()
    clock.tick(60)

pygame.quit()

The loop is the heart of every pygame game: handle events, update and draw the screen, then show the new frame with display.flip(). clock.tick(60) keeps it running at about 60 frames per second. From here, try moving the circle with the arrow keys using pygame.key.get_pressed().

Troubleshooting

  • pip not recognized: use py -m pip instead of pip.
  • Build errors on install: your Python version may be too new for the latest pygame wheel. Try pygame-ce, or install a Python version with a pre-built wheel.
  • Import error in an editor: the editor may use a different Python. Select the same interpreter.
  • Related: running Python scripts.

Frequently Asked Questions

Is pygame free?

Yes. It is open source.

What is pygame-ce?

A community edition fork with frequent updates. Install it with py -m pip install pygame-ce; do not install both.

Do I need admin rights?

No. pip installs for your user if needed.

Should I use a virtual environment?

It is a good habit: py -m venv .venv, then activate it before installing.

Summary

  1. Install Python.
  2. Open Terminal.
  3. Run py -m pip install pygame.
  4. Test with the aliens example.
  5. Update with –upgrade.