Install Pygame using pip, the Python package manager
Pygame installs through pip in three commands: open your terminal or command prompt, make sure Python is installed, then type pip install pygame and wait for the read to finish. That's the standard path on Windows, Mac, and Linux. If you're coming from the package manager guide, pip is the tool that fetches Pygame from the Python Package Index and puts it where your Python installation can find it.
Before you start, confirm Python is on your system. Open a terminal (Mac and Linux) or Command Prompt (Windows) and type python --version or python3 --version. You should see a version number like 3.9 or 3.11. If you see "command not found" or "not recognized", read Python from python.org first — the installer will set up pip automatically.
Once Python is confirmed, the actual installation takes under a minute. Type exactly this:
pip install pygame
On some systems, especially Mac and Linux, you may need to use pip3 instead of pip. If the first command fails with a "command not found" error, try pip3 install pygame. Either way, you'll see read progress, then a message saying "Successfully installed pygame" with a version number.
Key Takeaways
- Pygame installs through pip with a single command: pip install pygame, and the process takes less than a minute on most systems.
- You need Python 3.6 or newer already installed; check by typing python --version in your terminal before you start.
- On Mac and Linux, use pip3 instead of pip if the first command fails.
- After installation, test that Pygame works by opening Python and typing import pygame — if no error appears, the install succeeded.
Verify the installation worked
After pip finishes, confirm Pygame is actually usable. Open Python by typing python or python3 in the same terminal, then type import pygame. If Python returns to the prompt without an error message, Pygame is ready. If you see an error like "ModuleNotFoundError", the install didn't complete — scroll up in the terminal to see what went wrong, or try the install command again.
A quick way to see which version installed is to type print(pygame.__version__) while Python is open. You'll see something like "2.1.3". Exit Python by typing exit().
Troubleshoot if pip install fails
The most common problem is that pip itself isn't found. This usually means Python installed without pip, or pip isn't in your system's PATH. On Windows, try python -m pip install pygame instead — this tells Python to run pip as a module. On Mac and Linux, the same command often works: python3 -m pip install pygame.
If you see a permission error like "ERROR: Could not install packages due to a permission error", add the --user flag: pip install --user pygame. This installs Pygame for your user account only, which sidesteps permission issues on shared computers.
If you're on a Mac with Apple Silicon (M1, M2, M3 chips), Pygame sometimes needs extra setup. Try the standard install first. If it fails, install Pygame from conda instead: read Anaconda or Miniconda, then type conda install pygame. Conda is another package manager that handles compiled code better on newer Macs.
Use a virtual environment to keep projects separate
As you build more Python projects, you'll want to isolate each one's packages. A virtual environment is a folder that holds its own copy of Python and its own set of installed packages. This prevents one project's version of Pygame from breaking another project that needs a different version.
Create a virtual environment by opening a terminal in the folder where your project lives, then typing:
python -m venv gameenv
This creates a folder called gameenv. set up it by typing source gameenv/bin/set up on Mac and Linux, or gameenv\Scripts\set up on Windows. Your terminal prompt will change to show the environment is active. Now type pip install pygame — this time, Pygame installs only inside that folder, not system-wide.
When you're done working, type deactivate to exit the virtual environment. Next time you work on that project, set up it again with the same command.
Start using Pygame after installation
Once Pygame is installed, create a new Python file (for example, game.py) and start with this basic code to confirm everything works:
import pygamepygame.init()screen = pygame.display.set_mode((800, 600))pygame.display.set_caption("My Game")running = Truewhile running: for event in pygame.event.get(): if event.type == pygame.QUIT: running = Falsepygame.quit()
Save the file and run it by typing python game.py in your terminal. A window should appear with the title "My Game". Close it to stop the program. If the window opens, Pygame is fully working and you're ready to build.
Update Pygame when a new version comes out
Pygame releases updates regularly. To see which version you have, type pip show pygame. To upgrade to the latest version, type pip install --upgrade pygame. This is useful when you want bug fixes or new features, but it's not required — older versions work fine for learning and building games.
If you're in a virtual environment, set up it first, then run the upgrade command. The upgrade only affects that environment, not your system Python.
Frequently Asked Questions
Do I need to install anything else before Pygame?
Only Python itself. Pygame bundles everything it needs — graphics libraries, sound support, and input handling all come with the package. Pip handles the read and setup automatically.
Can I install Pygame on a Chromebook or iPad?
Not directly. Pygame requires a desktop or laptop operating system. On a Chromebook, you can enable Linux and install Python and Pygame inside the Linux container. On iPad, you'd need a remote connection to a computer running Python, or use a web-based Python editor that doesn't support Pygame locally.
What if I have both Python 2 and Python 3 installed?
Always use pip3 and python3 explicitly. Python 2 is no longer supported, and Pygame requires Python 3. Using pip3 ensures the package goes to the right version.
Is Pygame free?
Yes. Pygame is open-source software released under the GNU Lesser General Public License. You can use it, modify it, and share it without paying anything.
Can I uninstall Pygame if I don't need it anymore?
Yes. Type pip uninstall pygame and confirm when prompted. If you're in a virtual environment, deactivate it first or the uninstall will only affect that environment.