python ModuleNotFoundError: No module named ‘psutil‘ 解决方案
微wx笑 2023-11-13【运维日志】39 0 0关键字: Python psutil
将BT面板的代码迁移到另一个系统时遇到问题:python ModuleNotFoundError: No module named ‘psutil‘ 解决方案pip install psutil或conda install psutil系统:Alibaba Cloud
将BT面板的代码迁移到另一个系统时遇到问题:
python ModuleNotFoundError: No module named ‘psutil‘
解决方案
1 2 3 | pip install psutil 或 conda install psutil |
系统:Alibaba Cloud Linux 系统有两个python版本,使用以下命令
1 | pip2 install psutil |
安装,遇到问题
1 2 3 4 5 6 | psutil could not be installed from sources. Perhaps Python header files are not installed. Try running: sudo yum install gcc python-devel error: command 'gcc' failed with exit status 1 ---------------------------------------- Command "/usr/bin/python2 -u -c " import setuptools, tokenize;__file__= '/tmp/pip-build-wcSFo5/psutil/setup.py' ;f=getattr(tokenize, 'open' , open )(__file__);code=f. read ().replace( '\r\n' , '\n' );f.close(); exec (compile(code, __file__, 'exec' )) " install --record /tmp/pip-gvmbg7-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-wcSFo5/psutil/ |
使用以下命令安装,提示找不到匹配的python-devel
1 2 3 4 | sudo yum install python-devel Last metadata expiration check: 1:24:07 ago on Mon 13 Nov 2023 02:04:57 PM CST. No match for argument: python-devel Error: Unable to find a match: python-devel |
后来发现需要使用
1 | yum install python2-devel |
来安装,安装成功之后,再执行
1 | pip2 install psutil |
就安装成功了;
问题解决。
本文由 微wx笑 创作,采用 署名-非商业性使用-相同方式共享 4.0 许可协议,转载请附上原文出处链接及本声明。
原文链接:https://www.ivu4e.cn/blog/service/2023-11-13/1948.html