千家信息网

安装psutil模块报错怎么解决

发表于:2026-10-31 作者:千家信息网编辑
千家信息网最后更新 2026年10月31日,这篇文章主要讲解了"安装psutil模块报错怎么解决",文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习"安装psutil模块报错怎么解决"吧!'*' tok
千家信息网最后更新 2026年10月31日安装psutil模块报错怎么解决

这篇文章主要讲解了"安装psutil模块报错怎么解决",文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习"安装psutil模块报错怎么解决"吧!

'*' token
psutil/_psutil_linux.c:190: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
psutil/_psutil_linux.c:240: 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:433: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
psutil/_psutil_linux.c:482: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
psutil/_psutil_linux.c:543: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'PsutilMethods'
psutil/_psutil_linux.c:582: error: expected specifier-qualifier-list before 'PyObject'
psutil/_psutil_linux.c: In function 'init_psutil_linux':
psutil/_psutil_linux.c:628: error: 'PyObject' undeclared (first use in this function)
psutil/_psutil_linux.c:628: error: (Each undeclared identifier is reported only once
psutil/_psutil_linux.c:628: error: for each function it appears in.)
psutil/_psutil_linux.c:628: error: 'v' undeclared (first use in this function)
psutil/_psutil_linux.c:632: error: 'module' undeclared (first use in this function)
psutil/_psutil_linux.c:632: warning: implicit declaration of function 'Py_InitModule'
psutil/_psutil_linux.c:632: error: 'PsutilMethods' undeclared (first use in this function)
psutil/_psutil_linux.c:635: warning: implicit declaration of function 'PyModule_AddIntConstant'
error: command 'gcc' failed with exit status 1

----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-cY1TLx/psutil/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-J4cL69-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-cY1TLx/psutil/



===============================================================

解决方法是安装python-devel,这是Python的头文件和静态库包:

[root@localhost ~]# yum install python-devel.x86_64
Failed to set locale, defaulting to C
Loaded plugins: product-id, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package python-devel.x86_64 0:2.6.6-51.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================
Package Arch Version Repository Size
===============================================================================================
Installing:
python-devel x86_64 2.6.6-51.el6 cdrom-server 171 k

Transaction Summary
===============================================================================================
Install 1 Package(s)

Total download size: 171 k
Installed size: 456 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : python-devel-2.6.6-51.el6.x86_64 1/1
Verifying : python-devel-2.6.6-51.el6.x86_64 1/1

Installed:
python-devel.x86_64 0:2.6.6-51.el6

Complete!
在用pip安装psutil模块
[root@localhost ~]# pip install psutil
DEPRECATION: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop support for Python 2.6
Collecting psutil
Using cached psutil-5.0.1.tar.gz
Installing collected packages: psutil
Running setup.py install for psutil ... done
Successfully installed psutil-5.0.1

感谢各位的阅读,以上就是"安装psutil模块报错怎么解决"的内容了,经过本文的学习后,相信大家对安装psutil模块报错怎么解决这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是,小编将为大家推送更多相关知识点的文章,欢迎关注!

模块 学习 内容 就是 思路 情况 文件 文章 方法 更多 知识 知识点 篇文章 跟着 这是 问题 静态 实践 推送 研究 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 中国互联网科技工作委员会毛军 科技互联网项目 互联网下的科技发展 平安科技 互联网 哈尔滨新华互联网科技 顺网科技2021年互联网排名 老年人脱离互联网科技的作文 哈尔滨新华互联网科技学院 金融科技与互联网金融相同和不同 广州恒生互联网科技有限 河南猎农互联网科技有限公司 南平创想时代互联网科技有限公司 西安小鹰速贷互联网科技有限公司 卓翼科技产业互联网合作 恒生互联网科技业指数调整周期 银行科技岗属于互联网吗 产业互联网科技服务公司 广州有谷有贝互联网科技有限公司 互联网科技大佬云集 恒生互联网科技趋势 互联网高科技 中国互联网科技股 互联网科技有限公司经营范围 圆梦互联网科技 科技类互联网 深圳互联网络科技有限公司 为想互联网科技 哈尔滨新华互联网科技 新华互联网科技2019 利用互联网等科技手段
0