安装Python的psutil模块时报错:error: command 'gcc' failed with exit status 1
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了安装Python的psutil模块时报错:error: command 'gcc' failed with exit status 1相关的知识,希望对你有一定的参考价值。
安装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
本文出自 “神秘园” 博客,请务必保留此出处http://3094526.blog.51cto.com/3084526/1873865
以上是关于安装Python的psutil模块时报错:error: command 'gcc' failed with exit status 1的主要内容,如果未能解决你的问题,请参考以下文章
python--接口测试--xlwt模块使用时报错情况解决方法
python已安装了一个包,但是导入包中的模块时报错没有这个包
【Python】在安装python模块时报错:Unicode Decode Error ascii codec can't decode byte…