Sunday, May 12, 2024
 Popular · Latest · Hot · Upcoming
20
rated 0 times [  20] [ 0]  / answers: 1 / hits: 120575  / 1 Year ago, fri, april 14, 2023, 8:29:33

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?


More From » 13.10

 Answers
0

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):



sudo apt-get install python-pygame


and then start the python2 interpreter



python2


and then try to import pygame as



import pygame


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:



nano ~/.bash_aliases


This may open an empty file, depending upon whether you have set an alias before and then type



alias python='python2'


Do not change symlinks in /usr/bin/python3, since this may break many application in Ubuntu 13.10 which use python3 vociriferously.


[#27675] Sunday, April 16, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
fertion

Total Points: 436
Total Questions: 121
Total Answers: 156

Location: England
Member since Sun, May 21, 2023
1 Year ago
fertion questions
Thu, Mar 9, 23, 06:46, 1 Year ago
Thu, Jun 17, 21, 01:06, 3 Years ago
Mon, Jun 13, 22, 07:30, 2 Years ago
Fri, Mar 10, 23, 12:13, 1 Year ago
;