Python系统性能信息模块psutil安装报错解决一例
发表于:2026-11-01 作者:千家信息网编辑
千家信息网最后更新 2026年11月01日,今天在执行python脚本时报如下错误:[root@localhost ~]# python mysql_watcher.py -p dbset.iniTraceback (most recent c
千家信息网最后更新 2026年11月01日Python系统性能信息模块psutil安装报错解决一例今天在执行python脚本时报如下错误:
[root@localhost ~]# python mysql_watcher.py -p dbset.ini
Traceback (most recent call last):
File "mysql_watcher.py", line 17, in
import psutil
ImportError: No module named psutil
经查询,psutil是python的系统性能信息模块,正确的安装方法如下:
[root@localhost ~]# yum install python-setuptools
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirror.bit.edu.cn
* extras: mirrors.btte.net
* updates: mirror.bit.edu.cn
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package python-setuptools.noarch 0:0.6.10-3.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================================
Installing:
python-setuptools noarch 0.6.10-3.el6 base 336 k
Transaction Summary
=============================================================================================================================================================
Install 1 Package(s)
Total download size: 336 k
Installed size: 1.5 M
Is this ok [y/N]: y
Downloading Packages:
python-setuptools-0.6.10-3.el6.noarch.rpm | 336 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : python-setuptools-0.6.10-3.el6.noarch 1/1
Verifying : python-setuptools-0.6.10-3.el6.noarch 1/1
Installed:
python-setuptools.noarch 0:0.6.10-3.el6
Complete!
[root@localhost ~]# easy_install psutil
Searching for psutil
Reading http://pypi.python.org/simple/psutil/
Best match: psutil 5.2.2
Downloading https://pypi.python.org/packages/57/93/47a2e3befaf194ccc3d05ffbcba2cdcdd22a231100ef7e4cf63f085c900b/psutil-5.2.2.tar.gz#md5=bb98d48796cd76d9ccee871aad720f9c
Processing psutil-5.2.2.tar.gz
Running psutil-5.2.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-aRZwy3/psutil-5.2.2/egg-dist-tmp-EDoxRo
warning: manifest_maker: MANIFEST.in, line 14: 'recursive-include' expects ...
warning: no previously-included files matching '*' found under directory 'docs/_build'
warning: no previously-included files matching '*' found under directory '.ci'
psutil/_psutil_linux.c: In function 'psutil_proc_cpu_affinity_set':
psutil/_psutil_linux.c:426: warning: suggest explicit braces to avoid ambiguous 'else'
psutil/_psutil_linux.c: In function 'init_psutil_linux':
psutil/_psutil_linux.c:630: warning: unused variable 'v'
Adding psutil 5.2.2 to easy-install.pth file
Installed /usr/lib/python2.6/site-packages/psutil-5.2.2-py2.6-linux-x86_64.egg
Processing dependencies for psutil
Finished processing dependencies for psutil
[root@localhost ~]# python mysql_watcher.py -p dbset.ini
Traceback (most recent call last):
File "mysql_watcher.py", line 17, in
import psutil
ImportError: No module named psutil
经查询,psutil是python的系统性能信息模块,正确的安装方法如下:
[root@localhost ~]# yum install python-setuptools
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirror.bit.edu.cn
* extras: mirrors.btte.net
* updates: mirror.bit.edu.cn
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package python-setuptools.noarch 0:0.6.10-3.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================================
Installing:
python-setuptools noarch 0.6.10-3.el6 base 336 k
Transaction Summary
=============================================================================================================================================================
Install 1 Package(s)
Total download size: 336 k
Installed size: 1.5 M
Is this ok [y/N]: y
Downloading Packages:
python-setuptools-0.6.10-3.el6.noarch.rpm | 336 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : python-setuptools-0.6.10-3.el6.noarch 1/1
Verifying : python-setuptools-0.6.10-3.el6.noarch 1/1
Installed:
python-setuptools.noarch 0:0.6.10-3.el6
Complete!
[root@localhost ~]# easy_install psutil
Searching for psutil
Reading http://pypi.python.org/simple/psutil/
Best match: psutil 5.2.2
Downloading https://pypi.python.org/packages/57/93/47a2e3befaf194ccc3d05ffbcba2cdcdd22a231100ef7e4cf63f085c900b/psutil-5.2.2.tar.gz#md5=bb98d48796cd76d9ccee871aad720f9c
Processing psutil-5.2.2.tar.gz
Running psutil-5.2.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-aRZwy3/psutil-5.2.2/egg-dist-tmp-EDoxRo
warning: manifest_maker: MANIFEST.in, line 14: 'recursive-include' expects
warning: no previously-included files matching '*' found under directory 'docs/_build'
warning: no previously-included files matching '*' found under directory '.ci'
psutil/_psutil_linux.c: In function 'psutil_proc_cpu_affinity_set':
psutil/_psutil_linux.c:426: warning: suggest explicit braces to avoid ambiguous 'else'
psutil/_psutil_linux.c: In function 'init_psutil_linux':
psutil/_psutil_linux.c:630: warning: unused variable 'v'
Adding psutil 5.2.2 to easy-install.pth file
Installed /usr/lib/python2.6/site-packages/psutil-5.2.2-py2.6-linux-x86_64.egg
Processing dependencies for psutil
Finished processing dependencies for psutil
信息
性能
模块
系统
方法
时报
脚本
错误
查询
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
手冲咖啡和咖啡机区别
互联网科技
广州大一互联网络科技有限公司
互联网科技有限公司经营范围
重庆互联网络科技
互联网的科技创新
科技服务与互联网
汉立互联网科技有限公司联系电话
科技赋能互联网健康
玖二柒互联网科技公司待遇
须眉科技是互联网公司吗
小米互联网科技园设置
承德科技产业互联网发展
天津腾达互联网科技有限公司
徐州市互联网科技有限公司
互联网科技圈年度人物
有人说阿里系是互联网科技企业
广东猫王互联网科技有限公司电话
互联网的黑科技实验室
广州全民伙伴互联网科技有限公司
互联网科技垄断
电子科技大学互联网
苏州大垚互联网科技
云创客互联网科技公司
互联网之后的科技是什么
江阴互联网智能科技产品进口
深圳市优智互联网科技有限公司
吉林省码上互联网科技电话
互联网公司属于科技吗
科技互联网专业务虚会材料