Install Pygame on Windows

Install Python, then Pygame with one command, and fix the PATH and "pip is not recognized" problems that trip up most Windows users.

2 min readUpdated
On this page

Step 1: Install Python#

  1. Download the latest Python 3 installer for Windows from python.org/downloads. Check the download page for which Python versions currently have Pygame wheels.
  2. Run the installer. On the first screen, tick Add python.exe to PATH, then click Install Now.
  3. When it finishes, open a new Command Prompt or PowerShell window (existing windows don't see the updated PATH).

The python.org installer also installs the py launcher, which picks the right Python even when PATH is messy. The commands below use py; if you prefer, python works the same when it's on your PATH.

The Microsoft Store shortcut

On a fresh Windows install, typing python may open the Microsoft Store instead of running Python. That's an "app execution alias". Either install Python from python.org as above, or turn off the aliases in Settings → Apps → Advanced app settings → App execution aliases.

Step 2: Install Pygame#

In Command Prompt or PowerShell:

Terminal
py -m pip install pygame

or, for the community edition:

Terminal
py -m pip install pygame-ce

You should see pip download a file ending in win_amd64.whl and finish with Successfully installed. If it instead starts "Building wheel" and fails, see pip install errors: your Python version probably has no prebuilt Pygame package yet.

Step 3: Check it works#

Terminal
py -c "import pygame; print(pygame.version.ver)"
py -m pygame.examples.aliens
Terminal
cd C:\path\to\your\game
py -m venv .venv
.venv\Scripts\activate
python -m pip install pygame

The prompt shows (.venv) while the environment is active. If PowerShell refuses to run activate because scripts are disabled, either use Command Prompt, or allow local scripts for your user:

Terminal
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned

Code editors#

In VS Code, install the Python extension, then use Python: Select Interpreter to pick the same Python (or .venv) you installed Pygame into. Most "No module named pygame" reports on Windows come from the editor using a different interpreter. IDLE, which comes with Python, always uses the Python it was installed with.

Common Windows problems#

ProblemFix
'pip' is not recognized as an internal or external commandUse py -m pip instead of pip.
'python' is not recognizedUse py, or reinstall Python with "Add python.exe to PATH".
No module named pygame in VS Code but it works in the terminalSelect the right interpreter in VS Code. More fixes.
Defaulting to user installation because normal site-packages is not writeableHarmless: pip installed for your user only.
Several Python versions installedpy -0 lists them; py -3.13 -m pip install pygame targets one.
↑ ↓ to moveEnter to openEsc to close