Navigate to http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame – an unofficial site providing windows binaries of open-source python packages for the official CPython distribution by Christoph Gohlke.
Download the appropriate pygame .whl
file according to your installed python version. (The file is named something like pygame -
<pygame version> - <python version>
- win32.whl
)
Run
pip install your-pygame-package.whl
inside your terminal, bash or consol.
Note: if pip
is not found in PATH
try to run python -m pip install your-pygame-package.whl
Check if you can import pygame as a python module
import pygame
If you do not get an error, you have correctly installed pygame on your computer :)
Open your terminal and run
sudo apt-get install python-pygame
Note: This will install pygame for python2
Try to import pygame inside
import pygame
If you do not get an error, you have correctly installed pygame on your linux system :)
There are two ways to install it on mac:
Method 1
Go to the Pygame downloads page and download the mac installer. Run it, and it should install Pygame on your Mac.
Method 2
Install Homebrew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Then use Homebrew to install Python 2.7.12 and Pygame:
brew install python; brew install homebrew/python/pygame
Now run Python in your terminal and try import pygame
. If it does not say anything, it's installed successfully.