首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法安装psutil

无法安装psutil
EN

Stack Overflow用户
提问于 2020-03-04 17:46:59
回答 2查看 10.2K关注 0票数 7

有人能告诉我为什么我不能安装psutil吗?我上MacOS了。我是个菜鸟,所以请耐心等待,但任何帮助都将不胜感激。这会与我安装的默认Python install vs v3有关吗?我是个命令行新手,所以很困惑是什么导致了这个错误以及如何修复它。

这是我得到的错误信息...

代码语言:javascript
复制
kasey@MacBook-Pro ~ % pip3 install psutil
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Defaulting to user installation because normal site-packages is not writeable
Collecting psutil
  Downloading psutil-5.7.0.tar.gz (449 kB)
     |████████████████████████████████| 449 kB 150 kB/s
Building wheels for collected packages: psutil
  Building wheel for psutil (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/4h/g406694s1hb_rc1vwchcn08c0000gn/T/pip-install-HsBPVK/psutil/setup.py'"'"'; __file__='"'"'/private/var/folders/4h/g406694s1hb_rc1vwchcn08c0000gn/T/pip-install-HsBPVK/psutil/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/4h/g406694s1hb_rc1vwchcn08c0000gn/T/pip-wheel-dsejsf
       cwd: /private/var/folders/4h/g406694s1hb_rc1vwchcn08c0000gn/T/pip-install-HsBPVK/psutil/
  Complete output (43 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.15-x86_64-2.7
  creating build/lib.macosx-10.15-x86_64-2.7/psutil
  copying psutil/_pswindows.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
  copying psutil/_common.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
  copying psutil/__init__.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
  copying psutil/_psosx.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
  copying psutil/_psbsd.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
  copying psutil/_psaix.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
  copying psutil/_pslinux.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
  copying psutil/_compat.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
  copying psutil/_psposix.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
  copying psutil/_pssunos.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
  creating build/lib.macosx-10.15-x86_64-2.7/psutil/tests
  copying psutil/tests/test_contracts.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
  copying psutil/tests/test_connections.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
  copying psutil/tests/runner.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
  copying psutil/tests/test_unicode.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
  copying psutil/tests/test_misc.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
  copying psutil/tests/test_posix.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
  copying psutil/tests/test_linux.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
  copying psutil/tests/test_sunos.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
  copying psutil/tests/__init__.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
  copying psutil/tests/test_aix.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
  copying psutil/tests/test_process.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
  copying psutil/tests/test_bsd.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
  copying psutil/tests/test_system.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
  copying psutil/tests/test_osx.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
  copying psutil/tests/test_memory_leaks.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
  copying psutil/tests/test_windows.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
  copying psutil/tests/__main__.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
  running build_ext
  building 'psutil._psutil_osx' extension
  creating build/temp.macosx-10.15-x86_64-2.7
  creating build/temp.macosx-10.15-x86_64-2.7/psutil
  creating build/temp.macosx-10.15-x86_64-2.7/psutil/arch
  creating build/temp.macosx-10.15-x86_64-2.7/psutil/arch/osx
  cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -iwithsysroot /usr/local/libressl/include -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -pipe -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=570 -DPSUTIL_OSX=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c psutil/_psutil_common.c -o build/temp.macosx-10.15-x86_64-2.7/psutil/_psutil_common.o
  xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
  error: command 'cc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for psutil
  Running setup.py clean for psutil
Failed to build psutil
Installing collected packages: psutil
    Running setup.py install for psutil ... error
    ERROR: Command errored out with exit status 1:
     command: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/4h/g406694s1hb_rc1vwchcn08c0000gn/T/pip-install-HsBPVK/psutil/setup.py'"'"'; __file__='"'"'/private/var/folders/4h/g406694s1hb_rc1vwchcn08c0000gn/T/pip-install-HsBPVK/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 /private/var/folders/4h/g406694s1hb_rc1vwchcn08c0000gn/T/pip-record-O5uazE/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /Users/kasey/Library/Python/2.7/include/python2.7/psutil
         cwd: /private/var/folders/4h/g406694s1hb_rc1vwchcn08c0000gn/T/pip-install-HsBPVK/psutil/
    Complete output (43 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.15-x86_64-2.7
    creating build/lib.macosx-10.15-x86_64-2.7/psutil
    copying psutil/_pswindows.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
    copying psutil/_common.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
    copying psutil/__init__.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
    copying psutil/_psosx.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
    copying psutil/_psbsd.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
    copying psutil/_psaix.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
    copying psutil/_pslinux.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
    copying psutil/_compat.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
    copying psutil/_psposix.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
    copying psutil/_pssunos.py -> build/lib.macosx-10.15-x86_64-2.7/psutil
    creating build/lib.macosx-10.15-x86_64-2.7/psutil/tests
    copying psutil/tests/test_contracts.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
    copying psutil/tests/test_connections.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
    copying psutil/tests/runner.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
    copying psutil/tests/test_unicode.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
    copying psutil/tests/test_misc.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
    copying psutil/tests/test_posix.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
    copying psutil/tests/test_linux.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
    copying psutil/tests/test_sunos.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
    copying psutil/tests/__init__.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
    copying psutil/tests/test_aix.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
    copying psutil/tests/test_process.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
    copying psutil/tests/test_bsd.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
    copying psutil/tests/test_system.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
    copying psutil/tests/test_osx.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
    copying psutil/tests/test_memory_leaks.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
    copying psutil/tests/test_windows.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
    copying psutil/tests/__main__.py -> build/lib.macosx-10.15-x86_64-2.7/psutil/tests
    running build_ext
    building 'psutil._psutil_osx' extension
    creating build/temp.macosx-10.15-x86_64-2.7
    creating build/temp.macosx-10.15-x86_64-2.7/psutil
    creating build/temp.macosx-10.15-x86_64-2.7/psutil/arch
    creating build/temp.macosx-10.15-x86_64-2.7/psutil/arch/osx
    cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -iwithsysroot /usr/local/libressl/include -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -pipe -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=570 -DPSUTIL_OSX=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c psutil/_psutil_common.c -o build/temp.macosx-10.15-x86_64-2.7/psutil/_psutil_common.o
    xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
    error: command 'cc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/4h/g406694s1hb_rc1vwchcn08c0000gn/T/pip-install-HsBPVK/psutil/setup.py'"'"'; __file__='"'"'/private/var/folders/4h/g406694s1hb_rc1vwchcn08c0000gn/T/pip-install-HsBPVK/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 /private/var/folders/4h/g406694s1hb_rc1vwchcn08c0000gn/T/pip-record-O5uazE/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /Users/kasey/Library/Python/2.7/include/python2.7/psutil Check the logs for full command output.
EN

回答 2

Stack Overflow用户

发布于 2020-07-21 03:38:01

当你安装了多个版本时会发生这种情况(对于我来说,我安装了python 3.5和3.7 ),你必须指定一个粒度版本,如下所示(对于3.7):

代码语言:javascript
复制
sudo apt-get install python3.7-dev -y

阅读更多:https://github.com/giampaolo/psutil/issues/1143#issuecomment-334695523

票数 7
EN

Stack Overflow用户

发布于 2020-08-26 09:28:00

对于用于python3的亚马逊网络服务的相同问题,您可能需要更明确地指定版本:

代码语言:javascript
复制
yum install python36-devel.x86_64

或者只是搜索正确的包名:

代码语言:javascript
复制
yum search python | grep -i dev
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60523156

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档