Python系統效能資訊模組psutil安裝報錯解決一例
今天在執行python指令碼時報如下錯誤:
[root@localhost ~]# python mysql_watcher.py -p dbset.ini
Traceback (most recent call last):
File "mysql_watcher.py", line 17, in <module>
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
Best match: psutil 5.2.2
Downloading
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 <dir> <pattern1> <pattern2> ...
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 <module>
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
Best match: psutil 5.2.2
Downloading
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 <dir> <pattern1> <pattern2> ...
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
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15498/viewspace-2140214/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 安裝psutil模組報錯的解決方法
- python中系統資訊模組--psutilPython
- Python自動化運維之psutil系統效能資訊模組Python運維
- Python獲取系統資訊模組psutil(轉載)Python
- yum方式安裝Percona XtraBackup報錯解決一例
- 安裝ionic 報錯 安裝canvas報錯 解決辦法Canvas
- psutil模組詳解
- 安裝sass報錯解決方案
- 解決fitz模組報錯
- 【cypress】2. 安裝Cypress(windows系統),以及cypress open報錯解決。Windows
- Laravel安裝horizon報錯解決方案Laravel
- mac Pro 安裝scrapy報錯解決Mac
- win安裝wordcloud報錯解決方案Cloud
- 解決centos7 安裝MySQLdb-python 報錯 方案CentOSMySqlPython
- 強制解除安裝報錯模組
- 解決HIS叢集系統的效能問題一例
- Windows 環境安裝 Horizon 報錯解決Windows
- npm install 安裝報錯解決方案NPM
- linux 安裝 jupyter報錯解決Linux
- CentOS 6安裝Oracle報錯解決方案CentOSOracle
- LR9.10安裝報錯解決
- 安裝vue/cli報錯問題解決Vue
- 雲電腦Win7系統安裝報錯詳解:問題與解決方案Win7
- keepalived啟動報錯解決一例
- Python-安裝部分包報錯解決辦法彙總Python
- 【已解決】pip已經安裝好了模組,執行程式碼還是報錯說沒安裝行程
- 使用Push方式安裝EM 12c Agent報Shell path is incorrect錯誤解決一例
- Python筆記之psutil模組(自動化運維利器psutil玩轉系統監控及管理)Python筆記運維
- nginx安裝擴充套件模組報錯Nginx套件
- psutil獲取作業系統負載資訊作業系統負載
- Linux系統yum安裝報錯Cannot find a valid baseurl for repo的解決方法Linux
- Mac更新python3.12 解決pip3安裝報錯MacPython
- 安裝sysbench過程報錯,解決辦法
- python安裝scrapy出錯怎麼解決Python
- 解決 PyCharm/Python 安裝 cv2 和 OpenCV 報錯的問題PyCharmPythonOpenCV
- kaldi的編譯安裝與報錯解決方法編譯
- centos7騰訊雲uwsgi安裝報錯解決CentOS
- 【安裝Android Studio報錯之解決方案】Android