安装Python的psutil模块:
tar zxvf psutil-2.0.0.tar.gz cd psutil-2.0.0 python setup.py install
报错:
running install running bdist_egg ...... psutil/_psutil_linux.c:12:20: error: Python.h: No such file or directory In file included from psutil/_psutil_linux.c:23: psutil/_psutil_linux.h:11: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token ...... psutil/_psutil_linux.h:20: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token psutil/_psutil_linux.c: In function ‘ioprio_get’: psutil/_psutil_linux.c:50: warning: implicit declaration of function ‘syscall’ psutil/_psutil_linux.c: At top level: psutil/_psutil_linux.c:70: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token ...... psutil/_psutil_linux.c:384: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘PsutilMethods’ psutil/_psutil_linux.c:421: error: expected specifier-qualifier-list before ‘PyObject’ psutil/_psutil_linux.c: In function ‘init_psutil_linux’: psutil/_psutil_linux.c:470: error: ‘PyObject’ undeclared (first use in this function) psutil/_psutil_linux.c:470: error: (Each undeclared identifier is reported only once psutil/_psutil_linux.c:470: error: for each function it appears in.) psutil/_psutil_linux.c:470: error: ‘module’ undeclared (first use in this function) psutil/_psutil_linux.c:470: warning: implicit declaration of function ‘Py_InitModule’ psutil/_psutil_linux.c:470: error: ‘PsutilMethods’ undeclared (first use in this function) error: command ‘gcc‘ failed with exit status 1
原因:
gcc包已装,缺少python-devel包
解决:
yum install python-devel -y
安装Python的psutil模块时报错:error: command 'gcc' failed with exit status 1
时间: 2024-10-27 13:13:39