每次我尝试在python命令提示符中通过"pip install psutil"命令,它会给我这个错误信息:
Complete output (38 lines):
running install
running build
running build_py
creating build
creating buildlib.win32-3.10
creating buildlib.win32-3.10psutil
copying psutil_common.py -> buildlib.win32-3.10psutil
copying psutil_compat.py -> buildlib.win32-3.10psutil
copying psutil_psaix.py -> buildlib.win32-3.10psutil
copying psutil_psbsd.py -> buildlib.win32-3.10psutil
copying psutil_pslinux.py -> buildlib.win32-3.10psutil
copying psutil_psosx.py -> buildlib.win32-3.10psutil
copying psutil_psposix.py -> buildlib.win32-3.10psutil
copying psutil_pssunos.py -> buildlib.win32-3.10psutil
copying psutil_pswindows.py -> buildlib.win32-3.10psutil
copying psutil__init__.py -> buildlib.win32-3.10psutil
creating buildlib.win32-3.10psutiltests
copying psutiltestsrunner.py -> buildlib.win32-3.10psutiltests
copying psutilteststest_aix.py -> buildlib.win32-3.10psutiltests
copying psutilteststest_bsd.py -> buildlib.win32-3.10psutiltests
copying psutilteststest_connections.py -> buildlib.win32-3.10psutiltests
copying psutilteststest_contracts.py -> buildlib.win32-3.10psutiltests
copying psutilteststest_linux.py -> buildlib.win32-3.10psutiltests
copying psutilteststest_memleaks.py -> buildlib.win32-3.10psutiltests
copying psutilteststest_misc.py -> buildlib.win32-3.10psutiltests
copying psutilteststest_osx.py -> buildlib.win32-3.10psutiltests
copying psutilteststest_posix.py -> buildlib.win32-3.10psutiltests
copying psutilteststest_process.py -> buildlib.win32-3.10psutiltests
copying psutilteststest_sunos.py -> buildlib.win32-3.10psutiltests
copying psutilteststest_system.py -> buildlib.win32-3.10psutiltests
copying psutilteststest_testutils.py -> buildlib.win32-3.10psutiltests
copying psutilteststest_unicode.py -> buildlib.win32-3.10psutiltests
copying psutilteststest_windows.py -> buildlib.win32-3.10psutiltests
copying psutiltests__init__.py -> buildlib.win32-3.10psutiltests
copying psutiltests__main__.py -> buildlib.win32-3.10psutiltests
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:Userswindows 10 proAppDataLocalProgramsPythonPython310-32python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\windows 10 pro\AppData\Local\Temp\pip-install-freyn2_2\psutil_d40b23d5499d4943a851ba2d31c42b65\setup.py'"'"'; __file__='"'"'C:\Users\windows 10 pro\AppData\Local\Temp\pip-install-freyn2_2\psutil_d40b23d5499d4943a851ba2d31c42b65\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('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:Userswindows 10 proAppDataLocalTemppip-record-8dc_d_jbinstall-record.txt' --single-version-externally-managed --compile --install-headers 'C:Userswindows 10 proAppDataLocalProgramsPythonPython310-32Includepsutil' Check the logs for full command output.
有谁能帮我一下吗?所以我最终可以编辑并运行。py文件
您可以坚持使用5.9.3版本以避免此错误
pip install psutil==5.9.3
看这里:https://github.com/giampaolo/psutil/issues/2165
正如错误日志中提到的,你需要从提供给你的链接安装编译器,因为你试图安装的包需要一个编译器,因为它使用C/c++/Cython或其他编译过的代码访问Win32 API (C/c++库),即Python扩展,不像其他纯Python包,只需要特定的Python版本,实现或位。
https://visualstudio.microsoft.com/visual-cpp-build-tools/