2010-06-15 20 views
65

C'est ce que j'ai essayé:Pourquoi easy_install ne trouve-t-il pas MySQLdb?

$ easy_install-2.6 -d /home/user/lib/python2.6 MySQLdb 
Searching for MySQLdb 
Reading http://pypi.python.org/simple/MySQLdb/ 
Couldn't find index page for 'MySQLdb' (maybe misspelled?) 
Scanning index of all packages (this may take a while) 
Reading http://pypi.python.org/simple/ 
No local packages or download links found for MySQLdb 
error: Could not find suitable distribution for Requirement.parse('MySQLdb') 

Répondre

140

Vous avez le nom du mauvais paquet.

MySQL-python est la bonne:

 
easy_install MySQL-python 

ou

 
pip install MySQL-python 
+2

Je ressemble à ceci installe actuellement MySQL-python 1.2.2, qui ne contient pas MySQLdb 1.2.3 – BryanWheelock

+0

Vous avez raison. Lien fixe. – bernie

+0

J'ai travaillé avec 'MySQLdb' mais maintenant il semble être indestructible. Est-ce que MySQL-python contemple MySQLdb? Ou je dois changer mon code? –

7

Adam est juste, mais avant d'exécuter easy_install MySQL-python vous devez vous assurer python-dev est installé comme il est pas installé par défaut.

L'installation s'effectue avec apt-get install python-dev.

5

Si vous utilisez « miam » la commande est sudo yum install python-devel (où Sudo peut être facultative en fonction de votre compte utilisateur)