python psutil 插件安装

xiaoxiao2021-02-28  70

1 系统信息

[root@web-30 psutil-3.2.2]# cat /etc/redhat-release CentOS release 6.8 (Final)

2 安装pip

yum install python-pip

3 下载及安装

3.1 下载

wget https://pypi.python.org/packages/source/p/psutil/psutil-3.2.2.tar.gz

3.2 安装

[root@web-30 ~]# tar -xf psutil-3.2.2.tar.gz

[root@web-30 ~]# cd psutil-3.2.2

[root@web-30 psutil-3.2.2]# python setup.py install

4 问题及解决方法:

4.1 问题:

[root@web-30 psutil-3.2.2]# python setup.py install running install running bdist_egg running egg_info writing psutil.egg-info/PKG-INFO writing top-level names to psutil.egg-info/top_level.txt writing dependency_links to psutil.egg-info/dependency_links.txt reading manifest file 'psutil.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no previously-included files matching '*' found under directory 'docs/_build' warning: manifest_maker: MANIFEST.in, line 18: 'recursive-include' expects <dir> <pattern1> <pattern2> ... writing manifest file 'psutil.egg-info/SOURCES.txt' installing library code to build/bdist.linux-x86_64/egg running install_lib running build_py creating build creating build/lib.linux-x86_64-2.6 creating build/lib.linux-x86_64-2.6/psutil copying psutil/_psposix.py -> build/lib.linux-x86_64-2.6/psutil copying psutil/_compat.py -> build/lib.linux-x86_64-2.6/psutil copying psutil/_pssunos.py -> build/lib.linux-x86_64-2.6/psutil copying psutil/_common.py -> build/lib.linux-x86_64-2.6/psutil copying psutil/_pswindows.py -> build/lib.linux-x86_64-2.6/psutil copying psutil/_pslinux.py -> build/lib.linux-x86_64-2.6/psutil copying psutil/__init__.py -> build/lib.linux-x86_64-2.6/psutil copying psutil/_psosx.py -> build/lib.linux-x86_64-2.6/psutil copying psutil/_psbsd.py -> build/lib.linux-x86_64-2.6/psutil running build_ext building 'psutil._psutil_linux' extension creating build/temp.linux-x86_64-2.6 creating build/temp.linux-x86_64-2.6/psutil gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPSUTIL_VERSION=322 -I/usr/include/python2.6 -c psutil/_psutil_linux.c -o build/temp.linux-x86_64-2.6/psutil/_psutil_linux.o psutil/_psutil_linux.c:12:20: error: Python.h: No such file or directory In file included from psutil/_psutil_linux.c:37: psutil/_psutil_linux.h:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token psutil/_psutil_linux.h:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token psutil/_psutil_linux.h:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token psutil/_psutil_linux.h:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token psutil/_psutil_linux.h:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token psutil/_psutil_linux.h:19: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token psutil/_psutil_linux.h:20: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token psutil/_psutil_linux.h:21: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token psutil/_psutil_linux.c:40: error: 'CHAR_BIT' undeclared here (not in a function) psutil/_psutil_linux.c: In function 'ioprio_get': psutil/_psutil_linux.c:72: warning: implicit declaration of function 'syscall' psutil/_psutil_linux.c: At top level: psutil/_psutil_linux.c:91: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token psutil/_psutil_linux.c:111: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token psutil/_psutil_linux.c:192: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token psutil/_psutil_linux.c:242: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token psutil/_psutil_linux.c:268: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token psutil/_psutil_linux.c:375: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token psutil/_psutil_linux.c:429: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token psutil/_psutil_linux.c:478: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token psutil/_psutil_linux.c:556: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'PsutilMethods' psutil/_psutil_linux.c:595: error: expected specifier-qualifier-list before 'PyObject' psutil/_psutil_linux.c: In function 'init_psutil_linux': psutil/_psutil_linux.c:641: error: 'PyObject' undeclared (first use in this function) psutil/_psutil_linux.c:641: error: (Each undeclared identifier is reported only once psutil/_psutil_linux.c:641: error: for each function it appears in.) psutil/_psutil_linux.c:641: error: 'v' undeclared (first use in this function) psutil/_psutil_linux.c:645: error: 'module' undeclared (first use in this function) psutil/_psutil_linux.c:645: warning: implicit declaration of function 'Py_InitModule' psutil/_psutil_linux.c:645: error: 'PsutilMethods' undeclared (first use in this function) psutil/_psutil_linux.c:648: warning: implicit declaration of function 'PyModule_AddIntConstant' error: command 'gcc' failed with exit status 1

4.2 解决方法:

[root@web-30 psutil-3.2.2]# yum install python-devel

转载请注明原文地址: https://www.6miu.com/read-52986.html

最新回复(0)