(1)pyhton shell下导入MySQLdb失败。
(2)下载解压MySQL-python。
http://pypi.python.org/pypi/MySQL-python/#downloads
(3)build时提示缺少setuptools。
(4)下载安装setuptools。
http://pypi.python.org/pypi/setuptools#downloads![](http://www.redicecn.com/uploads/allimg/110417/2_110417183445_1.gif)
(5)测试导入setuptools成功(证明setuptools安装成功)。
![](http://www.redicecn.com/uploads/allimg/110417/2_110417183536_1.gif)
(6)测试导入setuptools成功(证明setuptools安装成功)。
![](http://www.redicecn.com/uploads/allimg/110417/2_110417183536_1.gif)
(7)安装python-MySQLdb 出现error: command 'gcc' failed with exit status 1的解决方法。
yum install python-devel(8)import error: libmysqlclient.so.18: cannot open shared object file: No such file or directory。
ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18(9)build mysqldb成功。
![](http://www.redicecn.com/uploads/allimg/110417/2_110417183602_1.gif)
(10)安装 mysqldb成功。
![](http://www.redicecn.com/uploads/allimg/110417/2_110417183629_1.gif)
(11)测试导入mysqldb成功。
![](http://www.redicecn.com/uploads/allimg/110417/2_110417183659_1.gif)