使用pip安装matplotlib的时候出现了以下错误:
....
_posixsubprocess.c:3:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1
- fatal error: Python.h: No such file or directory
- command ‘gcc’ failed with exit status 1
更新了gcc,还是不行,最后发现需要是缺少python-devel包,使用下面命令解决:
#centos
sudo yum -y install python-devel
#ubuntu
sudo apt-get install python-dev
#python3使用python3-dev