Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

An example to solve the installation error of Python system performance Information Module psutil

2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Today when executing the python script the Times made the following error:

[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

After query, psutil is the system performance information module of python. The correct installation method is as follows:

[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 0RU 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 336k

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 Compact 1

Verifying: python-setuptools-0.6.10-3.el6.noarch 1 Compact 1

Installed:

Python-setuptools.noarch 0RO 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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report