AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / computer / 问题 / 1447796
Accepted
Weirdali
Weirdali
Asked: 2019-06-13 02:48:00 +0800 CST2019-06-13 02:48:00 +0800 CST 2019-06-13 02:48:00 +0800 CST

尝试安装 psutil 结果出错

  • 772

因此,使用以下命令:

pip install psutil
pip3 install psutil
sudo pip install psutil
python -m pip install psutil 
python3 -m pip install psutil
sudo python -m pip install psutil 
sudo python3 -m pip install psutil 

(我也用 pip3 尝试了上面的 python 命令,但它会返回

/usr/local/opt/python@2/bin/python2.7: No module named pip3

)

每一个都会导致以下可怕的错误,我认为这可能与我使用的 python 版本有关,但我不知道如何修复。有人有什么主意吗?我对 python 版本的理解是有限的。我已经确保 python 是最新的并且 pip 是最新的,但我相信我可能有不同版本的 python,我不知道如何找到正确的版本。

Collecting psutil
  Using cached https://files.pythonhosted.org/packages/1c/ca/5b8c1fe032a458c2c4bcbe509d1401dca9dda35c7fc46b36bb81c2834740/psutil-5.6.3.tar.gz
Installing collected packages: psutil
  Running setup.py install for psutil ... error
    ERROR: Complete output from command /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/qz/p48qhlk97jz017n6lg28qgx40000gn/T/pip-install-emd0g1al/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/qz/p48qhlk97jz017n6lg28qgx40000gn/T/pip-record-x4u1qnr2/install-record.txt --single-version-externally-managed --compile:
    ERROR: running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.9-x86_64-3.7
    creating build/lib.macosx-10.9-x86_64-3.7/psutil
    copying psutil/_pswindows.py -> build/lib.macosx-10.9-x86_64-3.7/psutil
    copying psutil/_common.py -> build/lib.macosx-10.9-x86_64-3.7/psutil
    copying psutil/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/psutil
    copying psutil/_psosx.py -> build/lib.macosx-10.9-x86_64-3.7/psutil
    copying psutil/_psbsd.py -> build/lib.macosx-10.9-x86_64-3.7/psutil
    copying psutil/_psaix.py -> build/lib.macosx-10.9-x86_64-3.7/psutil
    copying psutil/_pslinux.py -> build/lib.macosx-10.9-x86_64-3.7/psutil
    copying psutil/_compat.py -> build/lib.macosx-10.9-x86_64-3.7/psutil
    copying psutil/_psposix.py -> build/lib.macosx-10.9-x86_64-3.7/psutil
    copying psutil/_pssunos.py -> build/lib.macosx-10.9-x86_64-3.7/psutil
    creating build/lib.macosx-10.9-x86_64-3.7/psutil/tests
    copying psutil/tests/test_contracts.py -> build/lib.macosx-10.9-x86_64-3.7/psutil/tests
    copying psutil/tests/test_connections.py -> build/lib.macosx-10.9-x86_64-3.7/psutil/tests
    copying psutil/tests/runner.py -> build/lib.macosx-10.9-x86_64-3.7/psutil/tests
    copying psutil/tests/test_unicode.py -> build/lib.macosx-10.9-x86_64-3.7/psutil/tests
    copying psutil/tests/test_misc.py -> build/lib.macosx-10.9-x86_64-3.7/psutil/tests
    copying psutil/tests/test_posix.py -> build/lib.macosx-10.9-x86_64-3.7/psutil/tests
    copying psutil/tests/test_linux.py -> build/lib.macosx-10.9-x86_64-3.7/psutil/tests
    copying psutil/tests/test_sunos.py -> build/lib.macosx-10.9-x86_64-3.7/psutil/tests
    copying psutil/tests/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/psutil/tests
    copying psutil/tests/test_aix.py -> build/lib.macosx-10.9-x86_64-3.7/psutil/tests
    copying psutil/tests/test_process.py -> build/lib.macosx-10.9-x86_64-3.7/psutil/tests
    copying psutil/tests/test_bsd.py -> build/lib.macosx-10.9-x86_64-3.7/psutil/tests
    copying psutil/tests/test_system.py -> build/lib.macosx-10.9-x86_64-3.7/psutil/tests
    copying psutil/tests/test_osx.py -> build/lib.macosx-10.9-x86_64-3.7/psutil/tests
    copying psutil/tests/test_memory_leaks.py -> build/lib.macosx-10.9-x86_64-3.7/psutil/tests
    copying psutil/tests/test_windows.py -> build/lib.macosx-10.9-x86_64-3.7/psutil/tests
    copying psutil/tests/__main__.py -> build/lib.macosx-10.9-x86_64-3.7/psutil/tests
    running build_ext
    building 'psutil._psutil_osx' extension
    creating build/temp.macosx-10.9-x86_64-3.7
    creating build/temp.macosx-10.9-x86_64-3.7/psutil
    creating build/temp.macosx-10.9-x86_64-3.7/psutil/arch
    creating build/temp.macosx-10.9-x86_64-3.7/psutil/arch/osx
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=563 -DPSUTIL_OSX=1 -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c psutil/_psutil_common.c -o build/temp.macosx-10.9-x86_64-3.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 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command "/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/qz/p48qhlk97jz017n6lg28qgx40000gn/T/pip-install-emd0g1al/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/qz/p48qhlk97jz017n6lg28qgx40000gn/T/pip-record-x4u1qnr2/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/qz/p48qhlk97jz017n6lg28qgx40000gn/T/pip-install-emd0g1al/psutil/
macos unix
  • 1 1 个回答
  • 5870 Views

1 个回答

  • Voted
  1. Best Answer
    Fanatique
    2019-06-13T03:22:44+08:002019-06-13T03:22:44+08:00

    你需要在 MacOS 上安装 xcode 开发者工具。

    xcode-select --install
    

    这将安装您需要的开发人员工具。要切换到正确的路径,请尝试:

    xcode-select --switch /Library/Developer/CommandLineTools
    

    如果这不起作用,您可以重置 xcode:

    xcode-select --reset
    
    • 0

相关问题

  • 如何使用键盘快捷键在 macOS 终端中选择一行?

  • weechat, tig, htop, ranger等没有颜色

  • 如何在 macOS 的终端中切换切换(连续性)?

  • 如何强制chrome在macos中使用pac文件?

  • “npm config set prefix”在 macOS Mojave 中的用户拥有的目录上失败

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    Windows 照片查看器因为内存不足而无法运行?

    • 5 个回答
  • Marko Smith

    支持结束后如何激活 WindowsXP?

    • 6 个回答
  • Marko Smith

    远程桌面间歇性冻结

    • 7 个回答
  • Marko Smith

    Windows 10 服务称为 AarSvc_70f961。它是什么,我该如何禁用它?

    • 2 个回答
  • Marko Smith

    子网掩码 /32 是什么意思?

    • 6 个回答
  • Marko Smith

    鼠标指针在 Windows 中按下的箭头键上移动?

    • 1 个回答
  • Marko Smith

    VirtualBox 无法以 VERR_NEM_VM_CREATE_FAILED 启动

    • 8 个回答
  • Marko Smith

    应用程序不会出现在 MacBook 的摄像头和麦克风隐私设置中

    • 5 个回答
  • Marko Smith

    ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败:无法获取本地颁发者证书 (_ssl.c:1056)

    • 4 个回答
  • Marko Smith

    我如何知道 Windows 安装在哪个驱动器上?

    • 6 个回答
  • Martin Hope
    Albin 支持结束后如何激活 WindowsXP? 2019-11-18 03:50:17 +0800 CST
  • Martin Hope
    fixer1234 “HTTPS Everywhere”仍然相关吗? 2019-10-27 18:06:25 +0800 CST
  • Martin Hope
    Kagaratsch Windows 10 删除大量小文件的速度非常慢。有什么办法可以加快速度吗? 2019-09-23 06:05:43 +0800 CST
  • Martin Hope
    andre_ss6 远程桌面间歇性冻结 2019-09-11 12:56:40 +0800 CST
  • Martin Hope
    Riley Carney 为什么在 URL 后面加一个点会删除登录信息? 2019-08-06 10:59:24 +0800 CST
  • Martin Hope
    zdimension 鼠标指针在 Windows 中按下的箭头键上移动? 2019-08-04 06:39:57 +0800 CST
  • Martin Hope
    Inter Sys Ctrl+C 和 Ctrl+V 是如何工作的? 2019-05-15 02:51:21 +0800 CST
  • Martin Hope
    jonsca 我所有的 Firefox 附加组件突然被禁用了,我该如何重新启用它们? 2019-05-04 17:58:52 +0800 CST
  • Martin Hope
    MCK 是否可以使用文本创建二维码? 2019-04-02 06:32:14 +0800 CST
  • Martin Hope
    SoniEx2 更改 git init 默认分支名称 2019-04-01 06:16:56 +0800 CST

热门标签

windows-10 linux windows microsoft-excel networking ubuntu worksheet-function bash command-line hard-drive

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve