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
- 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.

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().
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
- Install Python.
- Open Terminal.
- Run py -m pip install pygame.
- Test with the aliens example.
- Update with –upgrade.

Kermit Matthews is a freelance writer based in Philadelphia, Pennsylvania with more than a decade of experience writing technology guides. He has a Bachelor’s and Master’s degree in Computer Science and has spent much of his professional career in IT management.
He specializes in writing content about iPhones, Android devices, Microsoft Office, and many other popular applications and devices.