python setup.py install 报错

2023-06-05,,

python setup.py install 报错信息

[root@VM_25_28_centos psutil-2.0.0]# python setup.py  install
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.6
creating build/lib.linux-x86_64-2.6/psutil
copying psutil/_psosx.py -> build/lib.linux-x86_64-2.6/psutil
copying psutil/_psposix.py -> build/lib.linux-x86_64-2.6/psutil
copying psutil/_pswindows.py -> build/lib.linux-x86_64-2.6/psutil
copying psutil/_psbsd.py -> build/lib.linux-x86_64-2.6/psutil
copying psutil/_common.py -> build/lib.linux-x86_64-2.6/psutil
copying psutil/_pslinux.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/__init__.py -> build/lib.linux-x86_64-2.6/psutil
running build_ext
building '_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 -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: 错误:Python.h:没有那个文件或目录
In file included from psutil/_psutil_linux.c:23:
psutil/_psutil_linux.h:11: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.h:12: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.h:13: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.h:14: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.h:18: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.h:19: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.h:20: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.c: 在函数‘ioprio_get’中:
psutil/_psutil_linux.c:50: 警告:隐式声明函数‘syscall’
psutil/_psutil_linux.c: 在文件层:
psutil/_psutil_linux.c:70: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.c:93: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.c:181: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.c:232: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.c:255: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.c:275: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.c:336: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.c:384: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘PsutilMethods’
psutil/_psutil_linux.c:421: 错误:expected specifier-qualifier-list before ‘PyObject’
psutil/_psutil_linux.c: 在函数‘init_psutil_linux’中:
psutil/_psutil_linux.c:470: 错误:‘PyObject’未声明(在此函数内第一次使用)
psutil/_psutil_linux.c:470: 错误:(即使在一个函数内多次出现,每个未声明的标识符在其
psutil/_psutil_linux.c:470: 错误:所在的函数内也只报告一次。)
psutil/_psutil_linux.c:470: 错误:‘module’未声明(在此函数内第一次使用)
psutil/_psutil_linux.c:470: 警告:隐式声明函数‘Py_InitModule’
psutil/_psutil_linux.c:470: 错误:‘PsutilMethods’未声明(在此函数内第一次使用)
error: command 'gcc' failed with exit status 1
[root@VM_25_28_centos psutil-2.0.0]#
[root@VM_25_28_centos psutil-2.0.0]# python setup.py install
running install
running build
running build_py
running build_ext
building '_psutil_linux' extension
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 -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: 错误:Python.h:没有那个文件或目录
In file included from psutil/_psutil_linux.c:23:
psutil/_psutil_linux.h:11: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.h:12: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.h:13: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.h:14: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.h:18: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.h:19: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.h:20: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.c: 在函数‘ioprio_get’中:
psutil/_psutil_linux.c:50: 警告:隐式声明函数‘syscall’
psutil/_psutil_linux.c: 在文件层:
psutil/_psutil_linux.c:70: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.c:93: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.c:181: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.c:232: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.c:255: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.c:275: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.c:336: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.c:384: 错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘PsutilMethods’
psutil/_psutil_linux.c:421: 错误:expected specifier-qualifier-list before ‘PyObject’
psutil/_psutil_linux.c: 在函数‘init_psutil_linux’中:
psutil/_psutil_linux.c:470: 错误:‘PyObject’未声明(在此函数内第一次使用)
psutil/_psutil_linux.c:470: 错误:(即使在一个函数内多次出现,每个未声明的标识符在其
psutil/_psutil_linux.c:470: 错误:所在的函数内也只报告一次。)
psutil/_psutil_linux.c:470: 错误:‘module’未声明(在此函数内第一次使用)
psutil/_psutil_linux.c:470: 警告:隐式声明函数‘Py_InitModule’
psutil/_psutil_linux.c:470: 错误:‘PsutilMethods’未声明(在此函数内第一次使用)
error: command 'gcc' failed with exit status 1

解决方法

yum install -y python-devel

python setup.py install 报错的相关教程结束。

《python setup.py install 报错.doc》

下载本文的Word格式文档,以方便收藏与打印。