本文主要是介绍centos 安装 MySQLdb 和 psycopg2,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
一.安装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++即可
这篇关于centos 安装 MySQLdb 和 psycopg2的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!