报错:Error loading MySQLdb module
尝试解决:安装MySQL-python报错:ImportError: No module named 'ConfigParser'
根据https://stackoverflow.com/questions/14087598/python-3-importerror-no-module-named-configparser了解到
python3不支持MySQLdb
接着安装mysqlclient,pip3 install mysqlclient
报错:OSError: mysql_config not found
mysql_config是来自于 mysql-devel ,我用的是MySQL社区版,所以实际安装的是mysql-community-devel,网上的说法是同时安装python-devel,如果你没有安装的话一起安装。
yum install python-devel mysql-community-devel -y
再次安装pip3 install mysqlclient成功
pip3 install mysqlclient
Collecting mysqlclient
Using cached mysqlclient-1.3.12.tar.gz
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... done
Successfully installed mysqlclient-1.3.12
参考https://www.jianshu.com/p/827cf26568d8