I tried to install Pygame into my Ubuntu laptop.
I opened the terminal and enetered :
sudo apt-get install python-pygame
Then after completing all the formalities I tried to use pygame in my python IDLE by typing:
import pygame
.
But the Idle says that there is no module called pygame. I searched for answers and tried a lot of them but I didnt find an answer. Can anyone please help !...
2 Answers
Fire up a terminal and run:
/usr/bin/python2
import pygame
If it doesn't give you any errors, you're good to go! You can then exit the interpreter with: CTRL+D
If it worked fine, that probably means you installed a custom version of Python that doesn't see the modules installed by apt-get
.
-
-
@edwinksl - Updated. The source I read must have been wrong. Jul 26, 2016 at 18:03
-
You might need to get pygame for Python 3 To do this first install pip to install Python packages...
sudo apt-get install python3-pip
Then install pygame...
python3 -m pip install pygame
That should be it :-)
pygame
for Python 2 and not Python 3. Did you install IDLE for Python 2 or for Python 3?idle
in your terminal and then tryimport pygame
?