Installing PyGame on a Windows PC This blog will tell you how you can install PyGame on a computer with Windows OS Tweet. Oct 22, 2018 By Team YoungWonks.
Active5 months ago
I am running Ubuntu 13.10. I have python 2.7.5 with anaconda 1.8.0. Whenever I start python and type
import pygame
it tells me that there is no module named pygame. How can I install pygame?
don.joey18.9k1414 gold badges7070 silver badges9595 bronze badges
saisanjeevsaisanjeev22722 gold badges33 silver badges1212 bronze badges
4 Answers
The reason you are not able to import pygame into your python interpreter is because you are installing it for python2 and starting the python3 interpreter(Ubuntu 13.10 uses python3 by default).
How To Install Pygame On Windows 10 64 Bit
To install pygame for python2(your version is 2.7.5), do this on a terminal(Ctrl+Alt+t):
and then start the python2 interpreter Mainstage software for mac.
and then try to import pygame as
To set python2 as your default interpreter, you can set an alias in your bash_aliases file. To do this, open a terminal and type:
This may open an empty file, depending upon whether you have set an alias before and then type
Do not change symlinks in
jobinjobin/usr/bin/python3
, since this may break many application in Ubuntu 13.10 which use python3 vociriferously.20.7k1212 gold badges8484 silver badges112112 bronze badges
I can confirm Jobin's suggestion in his comment:
Works flawlessly. Tested on 13.10.
Next time if you want to install a python package you can search whether it is in the repositories by running:
Then you can see the packages (if they are in the repositories) and their names. The output for
apt-cache search pygame
is In this list you can select the package (here:
python-pygame
) and run sudo apt-get install the-package-name
.For more debugging of dependencies see Installing pygame with pip.
Community♦
don.joeydon.joey18.9k1414 gold badges7070 silver badges9595 bronze badges
This should install pygame for python 3, as python3-pip is required for pygame.
Aniruddha TarodekarAniruddha Tarodekar
Install Pygame for Python 3
To install PyGame for Python 3.x on Ubuntu 19.04 and later open the terminal and type:
To install python3-pygame in Ubuntu 18.10 open the terminal and type:
Add this line to sources.list.
Save sources.list with the keyboard combination Ctrl+O and press Enter and exit with Ctrl+X
Update the list of available software and install python3-pygame.
Install Pygame for Python 2
To install python-pygame in all currently supported versions of Ubuntu open the terminal and type:
karelkarel68.5k1515 gold badges154154 silver badges174174 bronze badges