1. 程式人生 > >安裝psutil時提示缺少python.h頭文件(作記錄)

安裝psutil時提示缺少python.h頭文件(作記錄)

failed 記錄 error fat status 開發 all min clu

  通過pip或者源碼安裝psutil,都會提示缺少python.h頭文件,錯誤提示如下:

...
psutil/_psutil_common.c:9:20: fatal error: Python.h: No such file or directory
 #include <Python.h>
                    ^
compilation terminated.
error: command ‘gcc‘ failed with exit status 1
...

  出現此錯誤的原因是沒有安裝python-devel,python開發包,如果是支持yum的系統,直接yum安裝即可:

yum -y install python-devel

安裝psutil時提示缺少python.h頭文件(作記錄)