Python 错误:没有名为“psutil”的模块
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/50316358/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error : No module named 'psutil'
提问by SeyVetch
I've been trying to install Peter Chervenski's MultiNEAT
and ran into a problem while running setup.py (python setup.py build_ext
):
我一直在尝试安装Peter Chervenski's MultiNEAT
并在运行 setup.py ( python setup.py build_ext
)时遇到问题:
File "c:/Users/1234/Documents/Alex/multineat/peter-ch-MultiNEAT-f631e2f/setup.py", line 7, in from site-packages import psutil'
文件“c:/Users/1234/Documents/Alex/multineat/peter-ch-MultiNEAT-f631e2f/setup.py”,第 7 行,在 from site-packages import psutil'
And I made sure this module is installed: used pip install
a couple of times and it said:
我确保安装了这个模块:使用pip install
了几次,它说:
Requirement already satisfied: psutil in c:\users\1234\appdata\local\programs\python\python36-32\lib\site-packages
要求已经满足:psutil in c:\users\1234\appdata\local\programs\python\python36-32\lib\site-packages
And I checked this directory myself and found psutil
module there (I even deleted it and reinstalled one more time). And after that, I still got the same error with Python
not seeing psutil
. Is there any way I can solve this problem? (I am using Windows 10
, latest version of Python
)
我自己检查了这个目录并在psutil
那里找到了模块(我什至删除了它并重新安装了一次)。在那之后,我仍然Python
没有看到相同的错误psutil
。有什么办法可以解决这个问题吗?(我正在使用Windows 10
,最新版本的Python
)
回答by sai
Error I got in windows 10 while executing a python script ->
我在执行 python 脚本时在 Windows 10 中遇到的错误 ->
Traceback (most recent call last):
File "C:\Users\YOUR NAME\Desktop\Sample.py", line 2, in import psutil
ImportError: No module named psutil
回溯(最近一次调用最后一次):
导入 psutil 中的文件“C:\Users\YOUR NAME\Desktop\Sample.py”,第 2 行
导入错误:没有名为 psutil 的模块
This is how I resolved the issue ->
这就是我解决问题的方法->
C:\python -m pip install --upgrade pip
[Latest pip version got installed successfully]
【最新pip版本安装成功】
C:\>python -m pip install psutil
Collecting psutil
Downloading https://files.pythonhosted.org/packages/50/6a/34525bc4e6e153bf6e849a4c4e936742b365f6819c0462cebfa4f082a3c4/psutil-5.4.7-cp27-none-win_amd64.whl (220kB)
100% |UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU| 225kB 696kB/s
Installing collected packages: psutil
Successfully installed psutil-5.4.7
Finally, Sample.py got executed successfully
最后,Sample.py 执行成功
回答by Jadhav Gaurav
This worked for me..
这对我有用..
sudo pip install --upgrade psutil
回答by SeyVetch
I solved a problem and if you had a similar problem you should try this:
我解决了一个问题,如果你有类似的问题,你应该试试这个:
- upgrade
pip
to the latest version (python -m pip install --upgrade pip
) - delete
psutil
(C:\Users\(your username)\AppData\Local\Programs\Python\Python36-32\Lib\site-packages
) if you have it installed already - reupload
psutil
now usingpip install psutil
- 升级
pip
到最新版本 (python -m pip install --upgrade pip
) - 如果已经安装,请删除
psutil
(C:\Users\(your username)\AppData\Local\Programs\Python\Python36-32\Lib\site-packages
) psutil
现在使用重新上传pip install psutil
. It helped me and if you have a permission error, try opening cmd as administrator.
. 它帮助了我,如果您遇到权限错误,请尝试以管理员身份打开 cmd。
回答by Prashant Singh
Follow these steps on windows:
在 Windows 上执行以下步骤:
- Open command prompt in administrator mode
- Enter Command
python -m pip install psutil
- Upgrade pip if outdated
python -m pip install --upgrade pip
- 在管理员模式下打开命令提示符
- 输入命令
python -m pip install psutil
- 如果过时,请升级 pip
python -m pip install --upgrade pip