1.下载Python的MySQL支持库地址:http://sourceforge.net/projects/mysql-python/2.解压编译pythonsetup.pyinstall遇到第一个问题:_mysql.c:44:23:error:my_config.h:Nosuchfileordirectory解决办法,编辑setup_posix.py文件,将mysql_config.path设置成你安装的mysql的目录,比如/usr/local/mysql/bin/mysql_config3.在python中"importMySQLdb",遇到问题:ImportError:libmysqlclient_r.so.16:cannotopensharedobjectfile:Nosuchfileordirectory解决办法,编辑/etc/ld.so.conf.d/mysql-i386.conf文件改成正确的mysql安装地址,比如我的:usr/local/mysql/lib/mysql存盘后退出,执行ldconfig