MySQL-python-1.2.0 安装

首先需要mysql的原码包我用的是mysql-5.0.22
解压开MySQL-python-1.2.0.tar.gz
cd MySQL-python-1.2.0
vi _mysql.c
修改include
#include "structmember.h"
#include "/root/mysql-5.0.22/include/mysql.h"
#include "/root/mysql-5.0.22/include/mysqld_error.h"
#include "/root/mysql-5.0.22/include/errmsg.h"
然后修改setup.py
mysqlclient = os.getenv('mysqlclient', 'mysqlclient')

export mysqlversion="5.0.22"
export mysqlclient="mysqlclient_r"
export mysqloptlibs="ssl crypto"
export mysqlclient="mysqlclient"

setup.py 会调用mysql_conf
cp /usr/local/mysql/bin/mysql_config  /bin/
cp /usr/local/mysql/bin/mysql  /bin/

python setup.py build
python setup.py install
安装完成以后的放在
/usr/local/lib/python2.4/site-packages/MySQLdb/constants