pip3 安装 mysqlclient 的时候,出现报错 _mysql.c:32:20: fatal error: Python.h: No such file or directory
pip3 install mysqlclient==1.3.12
报错内容
_mysql.c:32:20: fatal error: Python.h: No such file or directory #include "Python.h" ^ compilation terminated. error: command 'gcc' failed with exit status 1
刚开始看到command 'gcc' failed
还以为是缺少gcc编译包,于是yum安装gcc相关
yum install gcc gcc-c++ kernel-devel
安装完成后依然报错,于是搜索:_mysql.c:32:20: fatal error: Python.h: No such file or directory 发现是缺少 python3-devel
centos 系统
Ubuntu,Debian系统
安装 python3-devel 依赖后,重新执行就解决了