Sto eseguendo Ubuntu 13.10. Ho Python 2.7.5 con anaconda 1.8.0. Ogni volta che avvio python e digito import pygame
mi dice che non esiste un modulo chiamato pygame.
Come posso installare pygame?
Risposta accettata:
Il motivo per cui non sei in grado di importare pygame nel tuo interprete python è perché lo stai installando per python2 e avvii l'interprete python3 (Ubuntu 13.10 usa python3 per impostazione predefinita).
Per installare pygame per python2 (la tua versione è 2.7.5), fallo su un terminale (Ctrl +Alt +t ):
sudo apt-get install python-pygame
e quindi avvia l'interprete python2
python2
e quindi prova a importare pygame come
import pygame
Per impostare python2 come tuo interprete predefinito, puoi impostare un alias nel tuo file bash_aliases. Per fare ciò, apri un terminale e digita:
nano ~/.bash_aliases
Questo potrebbe aprire un file vuoto, a seconda che tu abbia impostato un alias prima e poi digita
alias python='python2'
Non modificare i collegamenti simbolici in /usr/bin/python3
, poiché ciò potrebbe interrompere molte applicazioni in Ubuntu 13.10 che usano python3 a gran voce.