系统升级从 MacOSX10.13. 到 MacOSX10.14
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/q0/84smfrlx3y59_p9l6zkg2lmr0000gn/T/pip-install-392hsobe/psutil/setup.py'"'"'; __file__='"'"'/private/var/folders/q0/84smfrlx3y59_p9l6zkg2lmr0000gn/T/pip-install-392hsobe/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/q0/84smfrlx3y59_p9l6zkg2lmr0000gn/T/pip-wheel-yg0reewc --python-tag cp37
cwd: /private/var/folders/q0/84smfrlx3y59_p9l6zkg2lmr0000gn/T/pip-install-392hsobe/psutil/
Complete output (47 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.13-x86_64-3.7
creating build/lib.macosx-10.13-x86_64-3.7/psutil
copying psutil/_pswindows.py -> build/lib.macosx-10.13-x86_64-3.7/psutil
copying psutil/_common.py -> build/lib.macosx-10.13-x86_64-3.7/psutil
copying psutil/__init__.py -> build/lib.macosx-10.13-x86_64-3.7/psutil
copying psutil/_psosx.py -> build/lib.macosx-10.13-x86_64-3.7/psutil
copying psutil/_psbsd.py -> build/lib.macosx-10.13-x86_64-3.7/psutil
copying psutil/_psaix.py -> build/lib.macosx-10.13-x86_64-3.7/psutil
copying psutil/_pslinux.py -> build/lib.macosx-10.13-x86_64-3.7/psutil
copying psutil/_compat.py -> build/lib.macosx-10.13-x86_64-3.7/psutil
copying psutil/_psposix.py -> build/lib.macosx-10.13-x86_64-3.7/psutil
copying psutil/_pssunos.py -> build/lib.macosx-10.13-x86_64-3.7/psutil
creating build/lib.macosx-10.13-x86_64-3.7/psutil/tests
copying psutil/tests/test_contracts.py -> build/lib.macosx-10.13-x86_64-3.7/psutil/tests
copying psutil/tests/test_connections.py -> build/lib.macosx-10.13-x86_64-3.7/psutil/tests
copying psutil/tests/runner.py -> build/lib.macosx-10.13-x86_64-3.7/psutil/tests
copying psutil/tests/test_unicode.py -> build/lib.macosx-10.13-x86_64-3.7/psutil/tests
copying psutil/tests/test_misc.py -> build/lib.macosx-10.13-x86_64-3.7/psutil/tests
copying psutil/tests/test_posix.py -> build/lib.macosx-10.13-x86_64-3.7/psutil/tests
copying psutil/tests/test_linux.py -> build/lib.macosx-10.13-x86_64-3.7/psutil/tests
copying psutil/tests/test_sunos.py -> build/lib.macosx-10.13-x86_64-3.7/psutil/tests
copying psutil/tests/__init__.py -> build/lib.macosx-10.13-x86_64-3.7/psutil/tests
copying psutil/tests/test_aix.py -> build/lib.macosx-10.13-x86_64-3.7/psutil/tests
copying psutil/tests/test_process.py -> build/lib.macosx-10.13-x86_64-3.7/psutil/tests
copying psutil/tests/test_bsd.py -> build/lib.macosx-10.13-x86_64-3.7/psutil/tests
copying psutil/tests/test_system.py -> build/lib.macosx-10.13-x86_64-3.7/psutil/tests
copying psutil/tests/test_osx.py -> build/lib.macosx-10.13-x86_64-3.7/psutil/tests
copying psutil/tests/test_memory_leaks.py -> build/lib.macosx-10.13-x86_64-3.7/psutil/tests
copying psutil/tests/test_windows.py -> build/lib.macosx-10.13-x86_64-3.7/psutil/tests
copying psutil/tests/__main__.py -> build/lib.macosx-10.13-x86_64-3.7/psutil/tests
running build_ext
building 'psutil._psutil_osx' extension
creating build/temp.macosx-10.13-x86_64-3.7
creating build/temp.macosx-10.13-x86_64-3.7/psutil
creating build/temp.macosx-10.13-x86_64-3.7/psutil/arch
creating build/temp.macosx-10.13-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.14.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.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/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c psutil/_psutil_common.c -o build/temp.macosx-10.13-x86_64-3.7/psutil/_psutil_common.o
In file included from psutil/_psutil_common.c:9:
/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/include/python3.7m/Python.h:25:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
^~~~~~~~~
1 error 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/q0/84smfrlx3y59_p9l6zkg2lmr0000gn/T/pip-install-392hsobe/psutil/setup.py'"'"'; __file__='"'"'/private/var/folders/q0/84smfrlx3y59_p9l6zkg2lmr0000gn/T/pip-install-392hsobe/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/q0/84smfrlx3y59_p9l6zkg2lmr0000gn/T/pip-record-sz0yk2ib/install-record.txt --single-version-externally-managed --compile
cwd: /private/var/folders/q0/84smfrlx3y59_p9l6zkg2lmr0000gn/T/pip-install-392hsobe/psutil/
Complete output (47 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-10.13-x86_64-3.7
creating build/lib.macosx-10.13-x86_64-3.7/psutil
copying psutil/_pswindows.py -> build/lib.macosx-10.13-x86_64-3.7/psutil
copying psutil/_common.py -> build/lib.macosx-10.13-x86_64-3.7/psutil
copying psutil/__init__.py -> build/lib.macosx-10.13-x86_64-3.7/psutil
copying psutil/_psosx.py -> build/lib.macosx-10.13-x86_64-3.7/psutil
copying psutil/_psbsd.py -> build/lib.macosx-10.13-x86_64-3.7/psutil
copying psutil/_psaix.py -> build/lib.macosx-10.13-x86_64-3.7/psutil
copying psutil/_pslinux.py -> build/lib.macosx-10.13-x86_64-3.7/psutil
copying psutil/_compat.py -> build/lib.macosx-10.13-x86_64-3.7/psutil
copying psutil/_psposix.py -> build/lib.macosx-10.13-x86_64-3.7/psutil
copying psutil/_pssunos.py -> build/lib.macosx-10.13-x86_64-3.7/psutil
creating build/lib.macosx-10.13-x86_64-3.7/psutil/tests
copying psutil/tests/test_contracts.py -> build/lib.macosx-10.13-x86_64-3.7/psutil/tests
copying psutil/tests/test_connections.py -> build/lib.macosx-10.13-x86_64-3.7/psutil/tests
copying psutil/tests/runner.py -> build/lib.macosx-10.13-x86_64-3.7/psutil/tests
copying psutil/tests/test_unicode.py -> build/lib.macosx-10.13-x86_64-3.7/psutil/tests
copying psutil/tests/test_misc.py -> build/lib.macosx-10.13-x86_64-3.7/psutil/tests
copying psutil/tests/test_posix.py -> build/lib.macosx-10.13-x86_64-3.7/psutil/tests
copying psutil/tests/test_linux.py -> build/lib.macosx-10.13-x86_64-3.7/psutil/tests
copying psutil/tests/test_sunos.py -> build/lib.macosx-10.13-x86_64-3.7/psutil/tests
copying psutil/tests/__init__.py -> build/lib.macosx-10.13-x86_64-3.7/psutil/tests
copying psutil/tests/test_aix.py -> build/lib.macosx-10.13-x86_64-3.7/psutil/tests
copying psutil/tests/test_process.py -> build/lib.macosx-10.13-x86_64-3.7/psutil/tests
copying psutil/tests/test_bsd.py -> build/lib.macosx-10.13-x86_64-3.7/psutil/tests
copying psutil/tests/test_system.py -> build/lib.macosx-10.13-x86_64-3.7/psutil/tests
copying psutil/tests/test_osx.py -> build/lib.macosx-10.13-x86_64-3.7/psutil/tests
copying psutil/tests/test_memory_leaks.py -> build/lib.macosx-10.13-x86_64-3.7/psutil/tests
copying psutil/tests/test_windows.py -> build/lib.macosx-10.13-x86_64-3.7/psutil/tests
copying psutil/tests/__main__.py -> build/lib.macosx-10.13-x86_64-3.7/psutil/tests
running build_ext
building 'psutil._psutil_osx' extension
creating build/temp.macosx-10.13-x86_64-3.7
creating build/temp.macosx-10.13-x86_64-3.7/psutil
creating build/temp.macosx-10.13-x86_64-3.7/psutil/arch
creating build/temp.macosx-10.13-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.14.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.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/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c psutil/_psutil_common.c -o build/temp.macosx-10.13-x86_64-3.7/psutil/_psutil_common.o
In file included from psutil/_psutil_common.c:9:
/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/include/python3.7m/Python.h:25:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
^~~~~~~~~
1 error 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/q0/84smfrlx3y59_p9l6zkg2lmr0000gn/T/pip-install-392hsobe/psutil/setup.py'"'"'; __file__='"'"'/private/var/folders/q0/84smfrlx3y59_p9l6zkg2lmr0000gn/T/pip-install-392hsobe/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/q0/84smfrlx3y59_p9l6zkg2lmr0000gn/T/pip-record-sz0yk2ib/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
分析错误日志发现:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk 这个目录不存在,猜测应该是系统最新sdk目录于是做如下处理:
sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk
顺利解决问题
网友评论