centos7安装MySQLdb
1.先安装一些依赖包
yum install gcc python-devel mysql-devel -y
2.下载mysqldb1.2.5
3.进入解压目录执行
python setup.py install
出现如下错误:
Traceback (most recent call last):
File "setup.py", line 13, in <module>
from setup_posix import get_config
File "/data/sftp/cuiyf41/MySQL-python-1.2.5/setup_posix.py", line 2, in <module>
from ConfigParser import SafeConfigParser
ModuleNotFoundError: No module named 'ConfigParser'
是由于Anaconda中python的版本是3.X的版本导致的
解决方法:
cp /root/anaconda3/lib/python3.6/configparser.py /root/anaconda3/lib/python3.6/ConfigParser.py