ubuntu18.04或者ubuntu20.04 安装mysqlclient时报错
MySQLdb/_mysql.c:46:10: fatal error: Python.h: No such file or directory
46 | #include "Python.h"
| ^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
[end of output]
解决方法
1 Install python-dev
sudo apt-get install python-dev
sudo apt-get install python3-dev
如果不行下一步
2 安装libpython3.10-dev
sudo apt install libpython3.10-dev
注意:需要根据已经安装的python版本安装,如python3.8,则运行
sudo apt install libpython3.8-dev
如果不行下一步
3 全部解决方案
[FIXED] fatal error: Python.h: No such file or directory (opengenus.org)