Error Description
When installing mysqlclient with pip3, an error occurs: _mysql.c:32:20: fatal error: Python.h: No such file or directory
pip3 install mysqlclient==1.3.12
Error content
_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
Solution:
At first, I saw command 'GCC' failed
and thought it was the lack of GCC compilation package, so I installed GCC related tools using Yum or up2date
yum install gcc gcc-c++ kernel-devel
After the installation is completed, an error is still reported, so search:_ Mysql. C: 32:20: fatal error: Python. H: no such file or directory. It is found that python3 devel is missing
CentOS system
Python 2 version execution: sudo Yum install Python devel
Python 3 version execution: sudo Yum install Python 3 devel
Ubuntu, Debian system
Python 2 version execution: sudo apt get install Python dev
Python 3 version execution: sudo apt get install Python 3 dev
After installing the python 3-devel dependency, re-execute it to solve the problem