CS 1410 | Syllabus | Assignments | [print]
Installing PyGame
Windows:
- Download and install Python 3.x Get the latest stable release. Don’t go for the alpha or beta releases. It’s usually best to install for all users, if you have the privileges to do so. Also, setting the PATH variable in Windows is a good idea. Also, be sure to install pip and set environment variables. (As of March 22, 2019 the latest release is 3.7.2)
- Open a command prompt as administrator. Search for
cmd
, right click andRun as administrator
. - Navigate (using cd) to where Python is installed on your computer. For example “C:\Program Files\Python37”, or “C:\Users\username\AppData\Local\Python\Python37-32”.
- Check the version of python to make sure it is Python 3
python --version
- If you get an error saying ‘python’ is not recognized as an internal or external command try using
py
instead ofpython
for each of the following commands. If you get a similar error after tryingpy --version
you need to reinstall python 3 making sure to select the “Environment Variables” option under the installer options. - Update the pip installer
python -m pip install --upgrade pip
- If you get an error saying No module named pip, then you need to re install python 3 making sure to install the pip module.
- Install PyGame with
python -m pip install pygame
- Test by launching
IDLE 3
and doing animport pygame
. If that doesn’t produce an error, you should be good to go.
OS X:
- Install
brew
, using these instructions. This is a package manager. It is capable of installing all sorts of programs. - If you need Python 3 installed:
brew install python3
- Link applications to Python3:
brew linkapps python3
- Install Pygame Dependencies:
brew install --with-python3 sdl sdl_image sdl_mixer sdl_ttf portmidi
- Install Pygame:
pip3 install pygame
Ubuntu 16.04:
sudo apt-get install python3-pip
sudo pip3 install pygame
Last Updated 09/27/2019