pip3 install psutilでlzmaがインポートできずエラー

23 min

段落スタイル 

iTerm2のテーマをポケモンにできるpokemon-terminalをインストールする際にハマったので解決方法をメモ

 

pip3 install psutilでエラー

Pythonまわりのものがうまいこといっておらずpip3 install psutilを実行したときにエラーが発生しました。

$  ~  pip3 install psutil
Collecting psutil
  Using cached https://files.pythonhosted.org/packages/1c/ca/5b8c1fe032a458c2c4bcbe509d1401dca9dda35c7fc46b36bb81c2834740/psutil-5.6.3.tar.gz
Building wheels for collected packages: psutil
  Building wheel for psutil (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/local/opt/python/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/79/62c7wljj0cj81f0l498_d1nc0000gp/T/pip-install-9hko4lq4/psutil/setup.py'"'"'; __file__='"'"'/private/var/folders/79/62c7wljj0cj81f0l498_d1nc0000gp/T/pip-install-9hko4lq4/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/79/62c7wljj0cj81f0l498_d1nc0000gp/T/pip-wheel-a0xo4t2m --python-tag cp37
       cwd: /private/var/folders/79/62c7wljj0cj81f0l498_d1nc0000gp/T/pip-install-9hko4lq4/psutil/
  Complete output (106 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.15-x86_64-3.7
  creating build/lib.macosx-10.15-x86_64-3.7/psutil
  copying psutil/_pswindows.py -> build/lib.macosx-10.15-x86_64-3.7/psutil
  copying psutil/_common.py -> build/lib.macosx-10.15-x86_64-3.7/psutil
  copying psutil/__init__.py -> build/lib.macosx-10.15-x86_64-3.7/psutil
  copying psutil/_psosx.py -> build/lib.macosx-10.15-x86_64-3.7/psutil
  copying psutil/_psbsd.py -> build/lib.macosx-10.15-x86_64-3.7/psutil
  copying psutil/_psaix.py -> build/lib.macosx-10.15-x86_64-3.7/psutil
  copying psutil/_pslinux.py -> build/lib.macosx-10.15-x86_64-3.7/psutil
  copying psutil/_compat.py -> build/lib.macosx-10.15-x86_64-3.7/psutil
  copying psutil/_psposix.py -> build/lib.macosx-10.15-x86_64-3.7/psutil
  copying psutil/_pssunos.py -> build/lib.macosx-10.15-x86_64-3.7/psutil
  creating build/lib.macosx-10.15-x86_64-3.7/psutil/tests
  copying psutil/tests/test_contracts.py -> build/lib.macosx-10.15-x86_64-3.7/psutil/tests
  copying psutil/tests/test_connections.py -> build/lib.macosx-10.15-x86_64-3.7/psutil/tests
  copying psutil/tests/runner.py -> build/lib.macosx-10.15-x86_64-3.7/psutil/tests
  copying psutil/tests/test_unicode.py -> build/lib.macosx-10.15-x86_64-3.7/psutil/tests
  copying psutil/tests/test_misc.py -> build/lib.macosx-10.15-x86_64-3.7/psutil/tests
  copying psutil/tests/test_posix.py -> build/lib.macosx-10.15-x86_64-3.7/psutil/tests
  copying psutil/tests/test_linux.py -> build/lib.macosx-10.15-x86_64-3.7/psutil/tests
  copying psutil/tests/test_sunos.py -> build/lib.macosx-10.15-x86_64-3.7/psutil/tests
  copying psutil/tests/__init__.py -> build/lib.macosx-10.15-x86_64-3.7/psutil/tests
  copying psutil/tests/test_aix.py -> build/lib.macosx-10.15-x86_64-3.7/psutil/tests
  copying psutil/tests/test_process.py -> build/lib.macosx-10.15-x86_64-3.7/psutil/tests
  copying psutil/tests/test_bsd.py -> build/lib.macosx-10.15-x86_64-3.7/psutil/tests
  copying psutil/tests/test_system.py -> build/lib.macosx-10.15-x86_64-3.7/psutil/tests
  copying psutil/tests/test_osx.py -> build/lib.macosx-10.15-x86_64-3.7/psutil/tests
  copying psutil/tests/test_memory_leaks.py -> build/lib.macosx-10.15-x86_64-3.7/psutil/tests
  copying psutil/tests/test_windows.py -> build/lib.macosx-10.15-x86_64-3.7/psutil/tests
  copying psutil/tests/__main__.py -> build/lib.macosx-10.15-x86_64-3.7/psutil/tests
  running build_ext
  building 'psutil._psutil_osx' extension
  creating build/temp.macosx-10.15-x86_64-3.7
  creating build/temp.macosx-10.15-x86_64-3.7/psutil
  creating build/temp.macosx-10.15-x86_64-3.7/psutil/arch
  creating build/temp.macosx-10.15-x86_64-3.7/psutil/arch/osx
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=563 -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.7.4_1/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c psutil/_psutil_common.c -o build/temp.macosx-10.15-x86_64-3.7/psutil/_psutil_common.o
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=563 -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.7.4_1/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c psutil/_psutil_posix.c -o build/temp.macosx-10.15-x86_64-3.7/psutil/_psutil_posix.o
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=563 -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.7.4_1/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c psutil/_psutil_osx.c -o build/temp.macosx-10.15-x86_64-3.7/psutil/_psutil_osx.o
  In file included from psutil/_psutil_osx.c:36:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:43:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:72:
  /usr/local/include/Block.h:16:3: error: Never include this file directly. Use <lzma.h> instead.
  #       error Never include this file directly. Use <lzma.h> instead.
          ^
  /usr/local/include/Block.h:93:2: error: unknown type name 'lzma_check'
          lzma_check check;
          ^
  /usr/local/include/Block.h:148:2: error: unknown type name 'lzma_vli'
          lzma_vli compressed_size;
          ^
  /usr/local/include/Block.h:172:2: error: unknown type name 'lzma_vli'
          lzma_vli uncompressed_size;
          ^
  /usr/local/include/Block.h:200:2: error: unknown type name 'lzma_filter'
          lzma_filter *filters;
          ^
  /usr/local/include/Block.h:217:20: error: use of undeclared identifier 'LZMA_CHECK_SIZE_MAX'
          uint8_t raw_check[LZMA_CHECK_SIZE_MAX];
                            ^
  /usr/local/include/Block.h:231:2: error: unknown type name 'lzma_vli'
          lzma_vli reserved_int3;
          ^
  /usr/local/include/Block.h:232:2: error: unknown type name 'lzma_vli'
          lzma_vli reserved_int4;
          ^
  /usr/local/include/Block.h:233:2: error: unknown type name 'lzma_vli'
          lzma_vli reserved_int5;
          ^
  /usr/local/include/Block.h:234:2: error: unknown type name 'lzma_vli'
          lzma_vli reserved_int6;
          ^
  /usr/local/include/Block.h:235:2: error: unknown type name 'lzma_vli'
          lzma_vli reserved_int7;
          ^
  /usr/local/include/Block.h:236:2: error: unknown type name 'lzma_vli'
          lzma_vli reserved_int8;
          ^
  /usr/local/include/Block.h:237:2: error: unknown type name 'lzma_reserved_enum'
          lzma_reserved_enum reserved_enum1;
          ^
  /usr/local/include/Block.h:238:2: error: unknown type name 'lzma_reserved_enum'
          lzma_reserved_enum reserved_enum2;
          ^
  /usr/local/include/Block.h:239:2: error: unknown type name 'lzma_reserved_enum'
          lzma_reserved_enum reserved_enum3;
          ^
  /usr/local/include/Block.h:240:2: error: unknown type name 'lzma_reserved_enum'
          lzma_reserved_enum reserved_enum4;
          ^
  /usr/local/include/Block.h:261:2: error: unknown type name 'lzma_bool'
          lzma_bool ignore_check;
          ^
  /usr/local/include/Block.h:263:2: error: unknown type name 'lzma_bool'
          lzma_bool reserved_bool2;
          ^
  /usr/local/include/Block.h:264:2: error: unknown type name 'lzma_bool'
          lzma_bool reserved_bool3;
          ^
  fatal error: too many errors emitted, stopping now [-ferror-limit=]
  20 errors generated.
  error: command 'clang' 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: /usr/local/opt/python/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/79/62c7wljj0cj81f0l498_d1nc0000gp/T/pip-install-9hko4lq4/psutil/setup.py'"'"'; __file__='"'"'/private/var/folders/79/62c7wljj0cj81f0l498_d1nc0000gp/T/pip-install-9hko4lq4/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/79/62c7wljj0cj81f0l498_d1nc0000gp/T/pip-record-zqdk_yjt/install-record.txt --single-version-externally-managed --compile
         cwd: /private/var/folders/79/62c7wljj0cj81f0l498_d1nc0000gp/T/pip-install-9hko4lq4/psutil/
    Complete output (106 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.15-x86_64-3.7
    creating build/lib.macosx-10.15-x86_64-3.7/psutil
    copying psutil/_pswindows.py -> build/lib.macosx-10.15-x86_64-3.7/psutil
    copying psutil/_common.py -> build/lib.macosx-10.15-x86_64-3.7/psutil
    copying psutil/__init__.py -> build/lib.macosx-10.15-x86_64-3.7/psutil
    copying psutil/_psosx.py -> build/lib.macosx-10.15-x86_64-3.7/psutil
    copying psutil/_psbsd.py -> build/lib.macosx-10.15-x86_64-3.7/psutil
    copying psutil/_psaix.py -> build/lib.macosx-10.15-x86_64-3.7/psutil
    copying psutil/_pslinux.py -> build/lib.macosx-10.15-x86_64-3.7/psutil
    copying psutil/_compat.py -> build/lib.macosx-10.15-x86_64-3.7/psutil
    copying psutil/_psposix.py -> build/lib.macosx-10.15-x86_64-3.7/psutil
    copying psutil/_pssunos.py -> build/lib.macosx-10.15-x86_64-3.7/psutil
    creating build/lib.macosx-10.15-x86_64-3.7/psutil/tests
    copying psutil/tests/test_contracts.py -> build/lib.macosx-10.15-x86_64-3.7/psutil/tests
    copying psutil/tests/test_connections.py -> build/lib.macosx-10.15-x86_64-3.7/psutil/tests
    copying psutil/tests/runner.py -> build/lib.macosx-10.15-x86_64-3.7/psutil/tests
    copying psutil/tests/test_unicode.py -> build/lib.macosx-10.15-x86_64-3.7/psutil/tests
    copying psutil/tests/test_misc.py -> build/lib.macosx-10.15-x86_64-3.7/psutil/tests
    copying psutil/tests/test_posix.py -> build/lib.macosx-10.15-x86_64-3.7/psutil/tests
    copying psutil/tests/test_linux.py -> build/lib.macosx-10.15-x86_64-3.7/psutil/tests
    copying psutil/tests/test_sunos.py -> build/lib.macosx-10.15-x86_64-3.7/psutil/tests
    copying psutil/tests/__init__.py -> build/lib.macosx-10.15-x86_64-3.7/psutil/tests
    copying psutil/tests/test_aix.py -> build/lib.macosx-10.15-x86_64-3.7/psutil/tests
    copying psutil/tests/test_process.py -> build/lib.macosx-10.15-x86_64-3.7/psutil/tests
    copying psutil/tests/test_bsd.py -> build/lib.macosx-10.15-x86_64-3.7/psutil/tests
    copying psutil/tests/test_system.py -> build/lib.macosx-10.15-x86_64-3.7/psutil/tests
    copying psutil/tests/test_osx.py -> build/lib.macosx-10.15-x86_64-3.7/psutil/tests
    copying psutil/tests/test_memory_leaks.py -> build/lib.macosx-10.15-x86_64-3.7/psutil/tests
    copying psutil/tests/test_windows.py -> build/lib.macosx-10.15-x86_64-3.7/psutil/tests
    copying psutil/tests/__main__.py -> build/lib.macosx-10.15-x86_64-3.7/psutil/tests
    running build_ext
    building 'psutil._psutil_osx' extension
    creating build/temp.macosx-10.15-x86_64-3.7
    creating build/temp.macosx-10.15-x86_64-3.7/psutil
    creating build/temp.macosx-10.15-x86_64-3.7/psutil/arch
    creating build/temp.macosx-10.15-x86_64-3.7/psutil/arch/osx
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=563 -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.7.4_1/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c psutil/_psutil_common.c -o build/temp.macosx-10.15-x86_64-3.7/psutil/_psutil_common.o
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=563 -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.7.4_1/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c psutil/_psutil_posix.c -o build/temp.macosx-10.15-x86_64-3.7/psutil/_psutil_posix.o
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=563 -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.7.4_1/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c psutil/_psutil_osx.c -o build/temp.macosx-10.15-x86_64-3.7/psutil/_psutil_osx.o
    In file included from psutil/_psutil_osx.c:36:
    In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:43:
    In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:72:
    /usr/local/include/Block.h:16:3: error: Never include this file directly. Use <lzma.h> instead.
    #       error Never include this file directly. Use <lzma.h> instead.
            ^
    /usr/local/include/Block.h:93:2: error: unknown type name 'lzma_check'
            lzma_check check;
            ^
    /usr/local/include/Block.h:148:2: error: unknown type name 'lzma_vli'
            lzma_vli compressed_size;
            ^
    /usr/local/include/Block.h:172:2: error: unknown type name 'lzma_vli'
            lzma_vli uncompressed_size;
            ^
    /usr/local/include/Block.h:200:2: error: unknown type name 'lzma_filter'
            lzma_filter *filters;
            ^
    /usr/local/include/Block.h:217:20: error: use of undeclared identifier 'LZMA_CHECK_SIZE_MAX'
            uint8_t raw_check[LZMA_CHECK_SIZE_MAX];
                              ^
    /usr/local/include/Block.h:231:2: error: unknown type name 'lzma_vli'
            lzma_vli reserved_int3;
            ^
    /usr/local/include/Block.h:232:2: error: unknown type name 'lzma_vli'
            lzma_vli reserved_int4;
            ^
    /usr/local/include/Block.h:233:2: error: unknown type name 'lzma_vli'
            lzma_vli reserved_int5;
            ^
    /usr/local/include/Block.h:234:2: error: unknown type name 'lzma_vli'
            lzma_vli reserved_int6;
            ^
    /usr/local/include/Block.h:235:2: error: unknown type name 'lzma_vli'
            lzma_vli reserved_int7;
            ^
    /usr/local/include/Block.h:236:2: error: unknown type name 'lzma_vli'
            lzma_vli reserved_int8;
            ^
    /usr/local/include/Block.h:237:2: error: unknown type name 'lzma_reserved_enum'
            lzma_reserved_enum reserved_enum1;
            ^
    /usr/local/include/Block.h:238:2: error: unknown type name 'lzma_reserved_enum'
            lzma_reserved_enum reserved_enum2;
            ^
    /usr/local/include/Block.h:239:2: error: unknown type name 'lzma_reserved_enum'
            lzma_reserved_enum reserved_enum3;
            ^
    /usr/local/include/Block.h:240:2: error: unknown type name 'lzma_reserved_enum'
            lzma_reserved_enum reserved_enum4;
            ^
    /usr/local/include/Block.h:261:2: error: unknown type name 'lzma_bool'
            lzma_bool ignore_check;
            ^
    /usr/local/include/Block.h:263:2: error: unknown type name 'lzma_bool'
            lzma_bool reserved_bool2;
            ^
    /usr/local/include/Block.h:264:2: error: unknown type name 'lzma_bool'
            lzma_bool reserved_bool3;
            ^
    fatal error: too many errors emitted, stopping now [-ferror-limit=]
    20 errors generated.
    error: command 'clang' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/opt/python/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/79/62c7wljj0cj81f0l498_d1nc0000gp/T/pip-install-9hko4lq4/psutil/setup.py'"'"'; __file__='"'"'/private/var/folders/79/62c7wljj0cj81f0l498_d1nc0000gp/T/pip-install-9hko4lq4/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/79/62c7wljj0cj81f0l498_d1nc0000gp/T/pip-record-zqdk_yjt/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.

 

解決方法

解決方法はdoctorをいれること、/usr/local/include/block.hの削除です。
まずはbrew doctorを実行しましょう。brewを入れていない人はまず入れておいてください。

$  ~  brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: The following directories do not exist:
/usr/local/sbin

You should create these directories and change their ownership to your account.
  sudo mkdir -p /usr/local/sbin
  sudo chown -R $(whoami) /usr/local/sbin

Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and which additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew-provided
script of the same name. We found the following "config" scripts:
  /Users/user/.pyenv/shims/icu-config
  /Users/user/.pyenv/shims/krb5-config
  /Users/user/.pyenv/shims/libpng16-config
  /Users/user/.pyenv/shims/python3.7-config
  /Users/user/.pyenv/shims/python3.7m-config
  /Users/user/.pyenv/shims/python-config
  /Users/user/.pyenv/shims/python3-config
  /Users/user/.pyenv/shims/ncursesw6-config
  /Users/user/.pyenv/shims/pcre-config

Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected header files:
  /usr/local/include/base.h
  /usr/local/include/bcj.h
  /usr/local/include/block.h
  /usr/local/include/check.h
  /usr/local/include/container.h
  /usr/local/include/delta.h
  /usr/local/include/filter.h
  /usr/local/include/hardware.h
  /usr/local/include/index.h
  /usr/local/include/index_hash.h
  /usr/local/include/lzma12.h
  /usr/local/include/stream_flags.h
  /usr/local/include/version.h
  /usr/local/include/vli.h

Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  docker
  kubernetes-cli

無事インストールできました。

次に/usr/local/include/block.hを削除します。

$  ~  rm -f /usr/local/include/block.h

pip3 install psutil再実行

最後にエラーが起きていたpip3 install psutilを再実行します。

$  ~  pip3 install psutil
Collecting psutil
  Using cached https://files.pythonhosted.org/packages/1c/ca/5b8c1fe032a458c2c4bcbe509d1401dca9dda35c7fc46b36bb81c2834740/psutil-5.6.3.tar.gz
Building wheels for collected packages: psutil
  Building wheel for psutil (setup.py) ... done
  Created wheel for psutil: filename=psutil-5.6.3-cp37-cp37m-macosx_10_15_x86_64.whl size=226054 sha256=90f6d71500b556d6ccfceaed6aceacf1f97f459a2cbb26203971c15421e885ff
  Stored in directory: /Users/user/Library/Caches/pip/wheels/90/7e/74/bb640d77775e6b6a78bcc3120f9fea4d2a28b2706de1cff37d
Successfully built psutil
Installing collected packages: psutil
Successfully installed psutil-5.6.3

 

無事インストールすることができました。