执行:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ mysql-python
错误信息:
_mysql.c:44:10: fatal error: my_config.h: 没有那个文件或目录
44 | #include "my_config.h"
| ^~~~~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
_mysql.c:44:10: fatal error: my_config.h: 没有那个文件或目录
44 | #include "my_config.h"
| ^~~~~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1

解决方法:
87 sudo apt-get update
88 sudo apt-get install mysql-server
89 sudo apt-get install libmysqlclient-dev
在安装:安装 _MySQL-python-1.2.5.zip mysql.c:44:10: fatal error: my_config.h: No such file or directory
sudo wget https://raw.githubusercontent.com/paulfitz/mysql-connector-c/master/include/my_config.h -P /usr/include/mysql/pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ mysql-python
再次执行:
成功:
解决Python安装mysql-python时my_config.h缺失的问题,
文章讲述了在使用pip安装mysql-python时遇到my_config.h文件缺失的错误,通过更新包管理器、安装MySQL服务器相关依赖以及手动下载my_config.h头文件,最终成功解决了问题。
1908






