为什么easy_install找不到MySQLdb?

Bry*_*ock 66 python mysql easy-install

这是我试过的:

$ 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')  
Run Code Online (Sandbox Code Playgroud)

ber*_*nie 143

您的包名称错误.

MySQL-python是正确的:

easy_install MySQL-python

要么

pip install MySQL-python

  • 我看起来目前正在安装MySQL-python 1.2.2,它不包含MySQLdb 1.2.3 (2认同)

小智 8

Adam是对的,但在运行之前,easy_install MySQL-python您需要确保python-dev已安装,因为默认情况下未安装.

安装是apt-get install python-dev.


小智 5

如果您使用"yum"命令是sudo yum install python-devel(其中'sudo'可能是可选的,具体取决于您的用户帐户)