wget https://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.5.zippython
unzip MySQL-python-1.2.5.zipmysql
cd MySQL-python-1.2.5sql
python setup.py buildui
報錯:mysql_config not found 解決: 1)使用whereis mysql命令找到mysql安裝目錄,假設mysql安裝在/usr/local/mysql 2) 回到MySQLdb源碼目錄, vi setup_posix.py打開配置文件,找到mysql_config.path一行,把路徑改成mysql安裝路徑下bin目錄,即mysql_config.path ="/usr/local/mysql/bin/mysql_config"。 若是MySQL安裝在系統默認路徑下,mysql_config腳本文件位於"/usr/bin/mysql_config"。(若是沒有mysql_config,則須要安裝mysql-devel包) 報錯:error: command 'gcc' failed with exit status 1 解決: yum install gcc python-devel
python setup.py installspa