一.安装MySQLdb
# yum install python-devel mysql-devel zlib-devel openssl-devel
# wget http://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.3.tar.gz
# tar -zxvf MySQL-python-1.2.3.tar.gz
# cd MySQL-python-1.2.3
# vi setup_posix.py
找到mysql_config.path 一行,改为mysql_config.path = "/usr/bin/mysql_config"
# python setup.py build
# python setup.py install
二. 安装psycopg2
# yum install python-devel mysql-devel zlib-devel openssl-devel
# wget https://pypi.python.org/packages/source/p/psycopg2/psycopg2-2.6.1.tar.gz # tar zxvf psycopg2-2.6.1.tar.gz # cd psycopg2-2.6.1 # python setup.py build # python setup.py install可能遇到的问题:
1.error: command 'gcc' failed with exit status 1
解决:执行 yum install gcc-c++即可