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
Similar Posts:
- [How to Solve] ImportError: No module named MySQLdb
- unable to execute ‘gcc’: No such file or directory
- How to Solve Error in installing MySQL Python in Pip
- CentOS 7: How to Solve Mysqlclient Install Error
- How to Solve Django Error: No module named ‘MySQLdb’
- Ubuntu16.04 Install python-ldap error: command ‘x86_64-linux-gnu-gcc’ failed with exit status 1
- [Solved] Centos6: Python 2.6 upgrade to 3.7, error handling [no module named ‘_ctypes’]
- Error “modulenotfounderror: no module named” in installing flash in Python 3.8_ ctypes’”
- Can’t find PHP headers in /usr/include/php The php-devel package is required for use of this command.
- Make Command ERROR: “make:*** No targets specified and no makefile found.Stop.” [Three Method to Solve]