提示:MySQL-python不用于python3
1.安装mysql ,检查版本
sudo yum install mysql
rpm -qa | grep mysql
2.下载与MySQL相匹配的mysql-devel的版本
sudo yum install mysql-devel
3.pip install mysql-python
如果无法使用pip 就去下载一个
遇见错误 fatal error: my_config.h: No such file or directory
解决方案
下载MySQL源代码,复制 my_config.h 到/usr/include
MySQL :: Download MySQL Community Server (Archived Versions)https://downloads.mysql.com/archives/community/
选择最后两个都可以
wget https://downloads.mysql.com/archives/get/p/23/file/mysql-boost-8.0.26.tar.gz
进行解压
找到my_config.h 复制到/usr/include
find -iname my_config.h
cp my_config.h /usr/include
再次运行
pip install mysql-python
还是出现错误 fatal error: my_config_x86_64.h: No such file or directory
解决方案 在/usr/include 目录下创建一个空的文件
touch my_config_x86_64.h
最后再次运行,出现错误,没有权限加上sudo 命令解决
sudo pip install mysql-python



