问题描述
我在OS X El Capitan上.
I am on OS X El Capitan.
我想为python脚本导入psutil,但得到module psutil not found
.
I want to import psutil for a python script, but get module psutil not found
.
如果执行pip install psutil
,我已经安装了psutil.
If I do pip install psutil
I get psutil already installed.
我怎么可能安装了psutil,但是在脚本中找不到它?
How is this possible that I have psutil installed, but it does not find it in the script?
我同时使用macports和Homebrew来安装几个python软件包.也许这是一个问题?
I am using both macports and homebrew to install several python packages. Maybe this is a problem?
有什么想法可以使psutil导入吗?
Any ideas how I can get psutil to import?
我的系统上有python27和python34.对于这个项目,我需要使用python27.
I have python27 and python34 on my system. For this project I need to use python27.
这是我的pip freeze
altgraph==0.10.2
bdist-mpkg==0.5.0
bonjour-py==0.3
chardet==2.3.0
git-remote-helpers==0.1.0
macholib==1.5.1
matplotlib==1.3.1
modulegraph==0.10.4
numpy==1.8.0rc1
PocketSphinx==0.8
psutil==4.0.0
py2app==0.7.3
PyAudio==0.2.9
pygal==2.1.1
pyobjc-core==2.5.1
pyobjc-framework-Accounts==2.5.1
pyobjc-framework-AddressBook==2.5.1
pyobjc-framework-AppleScriptKit==2.5.1
pyobjc-framework-AppleScriptObjC==2.5.1
pyobjc-framework-Automator==2.5.1
pyobjc-framework-CFNetwork==2.5.1
pyobjc-framework-Cocoa==2.5.1
pyobjc-framework-Collaboration==2.5.1
pyobjc-framework-CoreData==2.5.1
pyobjc-framework-CoreLocation==2.5.1
pyobjc-framework-CoreText==2.5.1
pyobjc-framework-DictionaryServices==2.5.1
pyobjc-framework-EventKit==2.5.1
pyobjc-framework-ExceptionHandling==2.5.1
pyobjc-framework-FSEvents==2.5.1
pyobjc-framework-InputMethodKit==2.5.1
pyobjc-framework-InstallerPlugins==2.5.1
pyobjc-framework-InstantMessage==2.5.1
pyobjc-framework-LatentSemanticMapping==2.5.1
pyobjc-framework-LaunchServices==2.5.1
pyobjc-framework-Message==2.5.1
pyobjc-framework-OpenDirectory==2.5.1
pyobjc-framework-PreferencePanes==2.5.1
pyobjc-framework-PubSub==2.5.1
pyobjc-framework-QTKit==2.5.1
pyobjc-framework-Quartz==2.5.1
pyobjc-framework-ScreenSaver==2.5.1
pyobjc-framework-ScriptingBridge==2.5.1
pyobjc-framework-SearchKit==2.5.1
pyobjc-framework-ServiceManagement==2.5.1
pyobjc-framework-Social==2.5.1
pyobjc-framework-SyncServices==2.5.1
pyobjc-framework-SystemConfiguration==2.5.1
pyobjc-framework-WebKit==2.5.1
pyOpenSSL==0.13.1
pyparsing==2.0.1
python-dateutil==1.5
pytz==2013.7
scipy==0.13.0b1
six==1.4.1
SphinxBase==0.8
vboxapi==1.0
wheel==0.26.0
xattr==0.6.4
zope.interface==4.1.1
推荐答案
只是尝试一览一下,这也是一种需要psutil的诊断工具.不幸出现错误:
Just tried to run glances, some kind of diagnostic tool that requires psutil aswell. Unfortunatelly got an error :
PsUtil module not found. Glances cannot start.
Ran pip冻结,看到我已安装它,因此我决定删除并尝试重新安装.卸载(成功卸载了psutil-5.0.1),并且再次尝试安装psutil-5.0.1时失败.再次点冻结,并发现有一个次要版本(psutil == 2.2.1),以防您删除最新版本(非常奇怪).无论如何,再次运行pip卸载psutil,删除该次要版本,然后当我再次尝试重新安装时,可以正常工作,安装最后一个版本.
Ran pip freeze, saw that i had it installed and i decided to remove and try to reinstall. Uninstalled (Successfully uninstalled psutil-5.0.1) and when tried again to install psutil-5.0.1 failed. Ran again pip freeze and noticed there is a minor version (psutil==2.2.1) that is served in case you remove the latest (very strange).Anyway, run again pip uninstall psutil, removed that minor version and when i tried again to reinstall worked correctly, installing the last version.
现在一切正常.
LE:Python 2.7.5
LE: Python 2.7.5
这篇关于即使安装了psutil,也没有此类模块psutil的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!