为什么我在安装 python 的 psutil 包时会出错?
Why I do get an error when installing the psutil package for python?
我在 windows 64 位机器(版本 3.10)上安装了 pyhton。之后我喜欢安装 psutil:
python -m pip install psutil
但我收到以下错误消息:
Collecting psutil
Using cached psutil-5.8.0.tar.gz (470 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Using legacy 'setup.py install' for psutil, since package 'wheel' is not installed.
Installing collected packages: psutil
Running setup.py install for psutil: started
Running setup.py install for psutil: finished with status 'error'
python : ERROR: Command errored out with exit status 1:
At line:1 char:1
+ python -m pip install psutil
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: ( ERROR: Comm... exit status 1::String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
command: 'C:\Users\FHBG1244\AppData\Local\Programs\Python\Python310\python.exe' -u -c 'import io, os, sys, setuptools, tokenize;
sys.argv[0] =
'"'"'C:\Users\FHBG1244\AppData\Local\Temp\pip-install-9hd47gcx\psutil_0500efeadf404b148d11c1599b34df08\setup.py'"'"'; __file__=
'"'"'C:\Users\FHBG1244\AppData\Local\Temp\pip-install-9hd47gcx\psutil_0500efeadf404b148d11c1599b34df08\setup.py'"'"';f =
getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup;
setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install
--record 'C:\Users\FHBG1244\AppData\Local\Temp\pip-record-2fhy6awl\install-record.txt' --single-version-externally-managed --compile
--install-headers 'C:\Users\FHBG1244\AppData\Local\Programs\Python\Python310\Include\psutil'
cwd: C:\Users\FHBG1244\AppData\Local\Temp\pip-install-9hd47gcx\psutil_0500efeadf404b148d11c1599b34df08\
Complete output (38 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.10
creating build\lib.win-amd64-3.10\psutil
copying psutil\_common.py -> build\lib.win-amd64-3.10\psutil
copying psutil\_compat.py -> build\lib.win-amd64-3.10\psutil
copying psutil\_psaix.py -> build\lib.win-amd64-3.10\psutil
copying psutil\_psbsd.py -> build\lib.win-amd64-3.10\psutil
copying psutil\_pslinux.py -> build\lib.win-amd64-3.10\psutil
copying psutil\_psosx.py -> build\lib.win-amd64-3.10\psutil
copying psutil\_psposix.py -> build\lib.win-amd64-3.10\psutil
copying psutil\_pssunos.py -> build\lib.win-amd64-3.10\psutil
copying psutil\_pswindows.py -> build\lib.win-amd64-3.10\psutil
copying psutil\__init__.py -> build\lib.win-amd64-3.10\psutil
creating build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\runner.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_aix.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_bsd.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_connections.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_contracts.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_linux.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_memleaks.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_misc.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_osx.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_posix.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_process.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_sunos.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_system.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_testutils.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_unicode.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_windows.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\__init__.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\__main__.py -> build\lib.win-amd64-3.10\psutil\tests
running build_ext
building 'psutil._psutil_windows' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools":
https://visualstudio.microsoft.com/visual-cpp-build-tools/
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\FHBG1244\AppData\Local\Programs\Python\Python310\python.exe' -u -c 'import
io, os, sys, setuptools, tokenize; sys.argv[0] =
'"'"'C:\Users\FHBG1244\AppData\Local\Temp\pip-install-9hd47gcx\psutil_0500efeadf404b148d11c1599b34df08\setup.py'"'"'; __file__=
'"'"'C:\Users\FHBG1244\AppData\Local\Temp\pip-install-9hd47gcx\psutil_0500efeadf404b148d11c1599b34df08\setup.py'"'"';f =
getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup;
setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install
--record 'C:\Users\FHBG1244\AppData\Local\Temp\pip-record-2fhy6awl\install-record.txt' --single-version-externally-managed --compile
--install-headers 'C:\Users\FHBG1244\AppData\Local\Programs\Python\Python310\Include\psutil' Check the logs for full command output.
这里有什么问题??
- 安装缺少的包
pip install wheel
安装时勾选此选项=>
- 重启你的机器。
- 运行cmd中的这个命令
pip install --upgrade setuptools
- 现在您可以运行在cmd中执行此命令
pip install psutil
- 终于上线了 运行! :-D ;-) 现在在我的机器上测试(
win10, python 3.10.0, pip 21.3
)!祝你好运 !最好的问候:-D
我在 windows 64 位机器(版本 3.10)上安装了 pyhton。之后我喜欢安装 psutil:
python -m pip install psutil
但我收到以下错误消息:
Collecting psutil
Using cached psutil-5.8.0.tar.gz (470 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Using legacy 'setup.py install' for psutil, since package 'wheel' is not installed.
Installing collected packages: psutil
Running setup.py install for psutil: started
Running setup.py install for psutil: finished with status 'error'
python : ERROR: Command errored out with exit status 1:
At line:1 char:1
+ python -m pip install psutil
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: ( ERROR: Comm... exit status 1::String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
command: 'C:\Users\FHBG1244\AppData\Local\Programs\Python\Python310\python.exe' -u -c 'import io, os, sys, setuptools, tokenize;
sys.argv[0] =
'"'"'C:\Users\FHBG1244\AppData\Local\Temp\pip-install-9hd47gcx\psutil_0500efeadf404b148d11c1599b34df08\setup.py'"'"'; __file__=
'"'"'C:\Users\FHBG1244\AppData\Local\Temp\pip-install-9hd47gcx\psutil_0500efeadf404b148d11c1599b34df08\setup.py'"'"';f =
getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup;
setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install
--record 'C:\Users\FHBG1244\AppData\Local\Temp\pip-record-2fhy6awl\install-record.txt' --single-version-externally-managed --compile
--install-headers 'C:\Users\FHBG1244\AppData\Local\Programs\Python\Python310\Include\psutil'
cwd: C:\Users\FHBG1244\AppData\Local\Temp\pip-install-9hd47gcx\psutil_0500efeadf404b148d11c1599b34df08\
Complete output (38 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.10
creating build\lib.win-amd64-3.10\psutil
copying psutil\_common.py -> build\lib.win-amd64-3.10\psutil
copying psutil\_compat.py -> build\lib.win-amd64-3.10\psutil
copying psutil\_psaix.py -> build\lib.win-amd64-3.10\psutil
copying psutil\_psbsd.py -> build\lib.win-amd64-3.10\psutil
copying psutil\_pslinux.py -> build\lib.win-amd64-3.10\psutil
copying psutil\_psosx.py -> build\lib.win-amd64-3.10\psutil
copying psutil\_psposix.py -> build\lib.win-amd64-3.10\psutil
copying psutil\_pssunos.py -> build\lib.win-amd64-3.10\psutil
copying psutil\_pswindows.py -> build\lib.win-amd64-3.10\psutil
copying psutil\__init__.py -> build\lib.win-amd64-3.10\psutil
creating build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\runner.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_aix.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_bsd.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_connections.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_contracts.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_linux.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_memleaks.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_misc.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_osx.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_posix.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_process.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_sunos.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_system.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_testutils.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_unicode.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_windows.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\__init__.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\__main__.py -> build\lib.win-amd64-3.10\psutil\tests
running build_ext
building 'psutil._psutil_windows' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools":
https://visualstudio.microsoft.com/visual-cpp-build-tools/
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\FHBG1244\AppData\Local\Programs\Python\Python310\python.exe' -u -c 'import
io, os, sys, setuptools, tokenize; sys.argv[0] =
'"'"'C:\Users\FHBG1244\AppData\Local\Temp\pip-install-9hd47gcx\psutil_0500efeadf404b148d11c1599b34df08\setup.py'"'"'; __file__=
'"'"'C:\Users\FHBG1244\AppData\Local\Temp\pip-install-9hd47gcx\psutil_0500efeadf404b148d11c1599b34df08\setup.py'"'"';f =
getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup;
setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install
--record 'C:\Users\FHBG1244\AppData\Local\Temp\pip-record-2fhy6awl\install-record.txt' --single-version-externally-managed --compile
--install-headers 'C:\Users\FHBG1244\AppData\Local\Programs\Python\Python310\Include\psutil' Check the logs for full command output.
这里有什么问题??
- 安装缺少的包
pip install wheel
安装时勾选此选项=>
- 重启你的机器。
- 运行cmd中的这个命令
pip install --upgrade setuptools
- 现在您可以运行在cmd中执行此命令
pip install psutil
- 终于上线了 运行! :-D ;-) 现在在我的机器上测试(
win10, python 3.10.0, pip 21.3
)!祝你好运 !最好的问候:-D