linux下安装python的mysql模块

1.MYSQL-Python下载地址

http://ncu.dl.sourceforge.net/project/mysql-python/mysql-python/1.2.3/MySQL-python-1.2.3.tar.gz



2.解压 
tar -zxvf MySQL-python-1.2.3.tar.gz

3.修改site.cfg

vi site.cfg
a)修改mysql_config为mysql配置文件的路径 /usr/local/mysql/bin/mysql_config 
b)threadsafe = False



4.安装
python setup.py build
python setup.py install



错误说明
_mysql.c:2810: error: expected declaration specifiers before ‘init_mysql’
_mysql.c:2888: error: expected ‘{’ at end of input
error: command 'gcc' failed with exit status 1



解决办法
yum install mysql-devel

yum install python-devel



你可能感兴趣的:(linux下安装python的mysql模块)