Skip to content

Installing pygame‐ce

Matiiss edited this page Mar 9, 2025 · 2 revisions

How do I download Pygame on VSCode again?
- Pygame Pro

The simple way

The one you probably already know

pip install pygame-ce

However, if you already have pygame installed, you MUST uninstall it first:

pip uninstall pygame
pip install pygame-ce

Now, suppose you messed the order up or something is still not working even after you have uninstalled pygame, you may want to ensure that your installation of pygame-ce is not corrupted:

pip install --force-reinstall pygame-ce

A quick detour regarding virtual environments

If you want a more in-depth explanation/tutorial on virtual environments in Python, I'd highly suggest the videos made by Corey Schafer:

Typically when working on a project, you want to use a virtual environment, it offers several benefits, but mainly it just helps isolate your project's environment from the rest of the system or other projects.

This wouldn't be a comprehensive guide if it didn't include how to deal with virtual environments...

Humble beginnings

To create a virtual environment, the easiest way would be to simply use the built-in venv package.
Firstly, open a terminal in your project's directory, then

python -m venv .venv

This will create a .venv directory (your environment directory) at the current working directory (your project's root directory).

Megazord, activate!

Now that you have got your virtual environment in your project's directory, you want to make sure you have activated it BEFORE performing any actions with python or pip:

  • On Windows:
    ./.venv/source/activate
    
  • On Mac & Linux:
    . ./.venv/bin/activate
    
    or
    source ./.venv/bin/activate
    

Note

Any time you close the terminal and reopen it again, you will likely have to activate the environment again.

Visual Studio Code (VSCode)

TODO (with images)

PyCharm

TODO (with images)

Common Errors

While installing packages in general with pip should be pretty straight-forward, it is inevitable that there will be some that will run into various issues. We don't all use identical computers, they are not all configured the same way, so it makes sense that instructions that work for (most) other people, may not work for you. Don't feel sad about that, it is quite likely you have run into an issue that someone else has run into before you and has managed to solve, so here is a compilation of such issues.

On Windows

TODO

On Mac & Linux

TODO

Relatively generic

TODO

FAQ

TODO