python 安装psutil

Posted aity007

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 安装psutil相关的知识,希望对你有一定的参考价值。

在使用python组件psutil时需要先安装,具体如下:

 

    wget https://pypi.python.org/packages/source/p/psutil/psutil-2.0.0.tar.gz
    tar -xzvf psutil-2.0.0.tar.gz
    cd psutil-2.0.0
    python setup.py install

安装的过程中可能报错如下:

psutil/_psutil_linux.c:421: error: expected specifier-qualifier-list before ?.yObject?
psutil/_psutil_linux.c: In function ?.nit_psutil_linux?.
psutil/_psutil_linux.c:470: error: ?.yObject?.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: ?.odule?.undeclared (first use in this function)
psutil/_psutil_linux.c:470: warning: implicit declaration of function ?.y_InitModule?
psutil/_psutil_linux.c:470: error: ?.sutilMethods?.undeclared (first use in this function)
error: command gcc failed with exit status 1

报错原因为没有安装python-devel导致,直接yum安装即可。

 

以上是关于python 安装psutil的主要内容,如果未能解决你的问题,请参考以下文章

安装psutil时提示缺少python.h头文件(作记录)

python 安装psutil包报错:

python笔记之psutil模块

python获取系统信息模块psutil

安装Python的psutil模块时报错:error: command 'gcc' failed with exit status 1

centos7 安装psutil