Pygame is a free Python library for making 2D games. To install it on Windows 10, install Python, open Terminal and run py -m pip install pygame, then test it with py -m pygame.examples.aliens. It takes 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.
How to Install Pygame on Windows 10
- Install Python from python.org (the Python install manager is now recommended) or from the Microsoft Store.
- Open Terminal or Command Prompt.
- Check Python with py –version.
- Run py -m pip install pygame.
- Wait for Successfully installed pygame.
- Test with py -m pygame.examples.aliens. A small game window should open.

Do I need admin rights?
No. pip installs for your user if needed.
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:
py -m venv .venvto create the environment..venv\Scripts\activateto switch to it (your prompt shows (.venv)). If PowerShell refuses to run the script, run the same command in Command Prompt instead.python -m pip install pygameto 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().
When Pip or Pygame Misbehaves
- 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.
What is pygame-ce?
A community edition fork with frequent updates. Install it with py -m pip install pygame-ce; do not install both.

Kermit Matthews runs Live2Tech from just outside Philadelphia. He is an IT specialist with over 20 years of experience, from a university help desk to small-business IT, IT management and his own consulting practice, and has written tech guides full time since 2020. Steps are checked against the current software on a real device or the maker’s official documentation. More about Kermit.