在使用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 oncepsutil/_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安装即可。