Trouble pip installing psutil on Mojave

帅比萌擦擦* 提交于 2021-01-28 08:46:39

问题


I'm trying to install psutil with the Homebrew version of Python on OSX Mojave.

Running:

pip3 install psutil 2> error.log

The console output is:

Collecting psutil
  Using cached psutil-5.7.2.tar.gz (460 kB)
Building wheels for collected packages: psutil
  Building wheel for psutil (setup.py) ... error
  Running setup.py clean for psutil
Failed to build psutil
Installing collected packages: psutil
    Running setup.py install for psutil ... error

and the error messages:

  ERROR: Command errored out with exit status 1:
   command: /usr/local/opt/python@3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/ps/v2x3jwmd0nn5ylp886xdzb1w0000gn/T/pip-install-6w_gsm04/psutil/setup.py'"'"'; __file__='"'"'/private/var/folders/ps/v2x3jwmd0nn5ylp886xdzb1w0000gn/T/pip-install-6w_gsm04/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/ps/v2x3jwmd0nn5ylp886xdzb1w0000gn/T/pip-wheel-pcxfxegq
       cwd: /private/var/folders/ps/v2x3jwmd0nn5ylp886xdzb1w0000gn/T/pip-install-6w_gsm04/psutil/
  Complete output (49 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.14-x86_64-3.8
  creating build/lib.macosx-10.14-x86_64-3.8/psutil
  copying psutil/_pswindows.py -> build/lib.macosx-10.14-x86_64-3.8/psutil
  copying psutil/_common.py -> build/lib.macosx-10.14-x86_64-3.8/psutil
  copying psutil/__init__.py -> build/lib.macosx-10.14-x86_64-3.8/psutil
  copying psutil/_psosx.py -> build/lib.macosx-10.14-x86_64-3.8/psutil
  copying psutil/_psbsd.py -> build/lib.macosx-10.14-x86_64-3.8/psutil
  copying psutil/_psaix.py -> build/lib.macosx-10.14-x86_64-3.8/psutil
  copying psutil/_pslinux.py -> build/lib.macosx-10.14-x86_64-3.8/psutil
  copying psutil/_compat.py -> build/lib.macosx-10.14-x86_64-3.8/psutil
  copying psutil/_psposix.py -> build/lib.macosx-10.14-x86_64-3.8/psutil
  copying psutil/_pssunos.py -> build/lib.macosx-10.14-x86_64-3.8/psutil
  creating build/lib.macosx-10.14-x86_64-3.8/psutil/tests
  copying psutil/tests/test_contracts.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
  copying psutil/tests/test_connections.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
  copying psutil/tests/runner.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
  copying psutil/tests/test_unicode.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
  copying psutil/tests/test_misc.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
  copying psutil/tests/test_posix.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
  copying psutil/tests/test_linux.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
  copying psutil/tests/test_sunos.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
  copying psutil/tests/__init__.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
  copying psutil/tests/test_aix.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
  copying psutil/tests/test_process.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
  copying psutil/tests/test_bsd.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
  copying psutil/tests/test_system.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
  copying psutil/tests/test_osx.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
  copying psutil/tests/test_memleaks.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
  copying psutil/tests/test_windows.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
  copying psutil/tests/__main__.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
  copying psutil/tests/test_testutils.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
  running build_ext
  building 'psutil._psutil_osx' extension
  creating build/temp.macosx-10.14-x86_64-3.8
  creating build/temp.macosx-10.14-x86_64-3.8/psutil
  creating build/temp.macosx-10.14-x86_64-3.8/psutil/arch
  creating build/temp.macosx-10.14-x86_64-3.8/psutil/arch/osx
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=572 -DPSUTIL_OSX=1 -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python@3.8/3.8.4/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c psutil/_psutil_common.c -o build/temp.macosx-10.14-x86_64-3.8/psutil/_psutil_common.o
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=572 -DPSUTIL_OSX=1 -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python@3.8/3.8.4/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c psutil/_psutil_posix.c -o build/temp.macosx-10.14-x86_64-3.8/psutil/_psutil_posix.o
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=572 -DPSUTIL_OSX=1 -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python@3.8/3.8.4/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c psutil/_psutil_osx.c -o build/temp.macosx-10.14-x86_64-3.8/psutil/_psutil_osx.o
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=572 -DPSUTIL_OSX=1 -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python@3.8/3.8.4/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c psutil/arch/osx/process_info.c -o build/temp.macosx-10.14-x86_64-3.8/psutil/arch/osx/process_info.o
  clang -bundle -undefined dynamic_lookup -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk build/temp.macosx-10.14-x86_64-3.8/psutil/_psutil_common.o build/temp.macosx-10.14-x86_64-3.8/psutil/_psutil_posix.o build/temp.macosx-10.14-x86_64-3.8/psutil/_psutil_osx.o build/temp.macosx-10.14-x86_64-3.8/psutil/arch/osx/process_info.o -L/usr/local/lib -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/sqlite/lib -o build/lib.macosx-10.14-x86_64-3.8/psutil/_psutil_osx.cpython-38-darwin.so -framework CoreFoundation -framework IOKit
  ld: unknown option: -platform_version
  clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
  error: command 'clang' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for psutil
    ERROR: Command errored out with exit status 1:
     command: /usr/local/opt/python@3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/ps/v2x3jwmd0nn5ylp886xdzb1w0000gn/T/pip-install-6w_gsm04/psutil/setup.py'"'"'; __file__='"'"'/private/var/folders/ps/v2x3jwmd0nn5ylp886xdzb1w0000gn/T/pip-install-6w_gsm04/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/ps/v2x3jwmd0nn5ylp886xdzb1w0000gn/T/pip-record-3swdof00/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/psutil
         cwd: /private/var/folders/ps/v2x3jwmd0nn5ylp886xdzb1w0000gn/T/pip-install-6w_gsm04/psutil/
    Complete output (49 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.14-x86_64-3.8
    creating build/lib.macosx-10.14-x86_64-3.8/psutil
    copying psutil/_pswindows.py -> build/lib.macosx-10.14-x86_64-3.8/psutil
    copying psutil/_common.py -> build/lib.macosx-10.14-x86_64-3.8/psutil
    copying psutil/__init__.py -> build/lib.macosx-10.14-x86_64-3.8/psutil
    copying psutil/_psosx.py -> build/lib.macosx-10.14-x86_64-3.8/psutil
    copying psutil/_psbsd.py -> build/lib.macosx-10.14-x86_64-3.8/psutil
    copying psutil/_psaix.py -> build/lib.macosx-10.14-x86_64-3.8/psutil
    copying psutil/_pslinux.py -> build/lib.macosx-10.14-x86_64-3.8/psutil
    copying psutil/_compat.py -> build/lib.macosx-10.14-x86_64-3.8/psutil
    copying psutil/_psposix.py -> build/lib.macosx-10.14-x86_64-3.8/psutil
    copying psutil/_pssunos.py -> build/lib.macosx-10.14-x86_64-3.8/psutil
    creating build/lib.macosx-10.14-x86_64-3.8/psutil/tests
    copying psutil/tests/test_contracts.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
    copying psutil/tests/test_connections.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
    copying psutil/tests/runner.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
    copying psutil/tests/test_unicode.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
    copying psutil/tests/test_misc.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
    copying psutil/tests/test_posix.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
    copying psutil/tests/test_linux.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
    copying psutil/tests/test_sunos.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
    copying psutil/tests/__init__.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
    copying psutil/tests/test_aix.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
    copying psutil/tests/test_process.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
    copying psutil/tests/test_bsd.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
    copying psutil/tests/test_system.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
    copying psutil/tests/test_osx.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
    copying psutil/tests/test_memleaks.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
    copying psutil/tests/test_windows.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
    copying psutil/tests/__main__.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
    copying psutil/tests/test_testutils.py -> build/lib.macosx-10.14-x86_64-3.8/psutil/tests
    running build_ext
    building 'psutil._psutil_osx' extension
    creating build/temp.macosx-10.14-x86_64-3.8
    creating build/temp.macosx-10.14-x86_64-3.8/psutil
    creating build/temp.macosx-10.14-x86_64-3.8/psutil/arch
    creating build/temp.macosx-10.14-x86_64-3.8/psutil/arch/osx
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=572 -DPSUTIL_OSX=1 -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python@3.8/3.8.4/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c psutil/_psutil_common.c -o build/temp.macosx-10.14-x86_64-3.8/psutil/_psutil_common.o
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=572 -DPSUTIL_OSX=1 -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python@3.8/3.8.4/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c psutil/_psutil_posix.c -o build/temp.macosx-10.14-x86_64-3.8/psutil/_psutil_posix.o
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=572 -DPSUTIL_OSX=1 -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python@3.8/3.8.4/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c psutil/_psutil_osx.c -o build/temp.macosx-10.14-x86_64-3.8/psutil/_psutil_osx.o
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=572 -DPSUTIL_OSX=1 -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python@3.8/3.8.4/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c psutil/arch/osx/process_info.c -o build/temp.macosx-10.14-x86_64-3.8/psutil/arch/osx/process_info.o
    clang -bundle -undefined dynamic_lookup -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk build/temp.macosx-10.14-x86_64-3.8/psutil/_psutil_common.o build/temp.macosx-10.14-x86_64-3.8/psutil/_psutil_posix.o build/temp.macosx-10.14-x86_64-3.8/psutil/_psutil_osx.o build/temp.macosx-10.14-x86_64-3.8/psutil/arch/osx/process_info.o -L/usr/local/lib -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/sqlite/lib -o build/lib.macosx-10.14-x86_64-3.8/psutil/_psutil_osx.cpython-38-darwin.so -framework CoreFoundation -framework IOKit
    ld: unknown option: -platform_version
    clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
    error: command 'clang' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/opt/python@3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/ps/v2x3jwmd0nn5ylp886xdzb1w0000gn/T/pip-install-6w_gsm04/psutil/setup.py'"'"'; __file__='"'"'/private/var/folders/ps/v2x3jwmd0nn5ylp886xdzb1w0000gn/T/pip-install-6w_gsm04/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/ps/v2x3jwmd0nn5ylp886xdzb1w0000gn/T/pip-record-3swdof00/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/psutil Check the logs for full command output.

I don't understand what the source of the error is. The linker seems to have a problem with the flag -platform_version even though it's not in any of the previous lines.

I have searched for other solutions that usually involve some variant of

xcode-select --install
xcode-select --reset

I've tried all that, including reinstalling command line tools but nothing seems to fix it. Is the issue potentially that I have to upgrade to Catalina? I've been putting that off because of its lack of 32-bit support. Thanks.

edit: This is what I get with "ld -v"

@(#)PROGRAM:ld  PROJECT:ld64-450.3
BUILD 18:16:53 Apr  5 2019
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
LTO support using: LLVM version 10.0.1, (clang-1001.0.46.4) (static support for 22, runtime is 22)
TAPI support using: Apple TAPI version 10.0.1 (tapi-1001.0.4.1)

来源:https://stackoverflow.com/questions/62987934/trouble-pip-installing-psutil-on-mojave

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!