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?
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).
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
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
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
In this list you can select the package (here:
For more debugging of dependencies see Installing pygame with pip.