我正在尝试通过pip3将工具安装到我的Mac上,但出现以下错误:
编译终止。 错误:命令'gcc'失败,退出状态为1 **
我注意到自Mohave以来其他人都遇到了这个问题,建议将位置更改为标头指向的位置,但是随着Catalina的更新,位置更改为/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include
,并尝试了CPATH=
之后和C_INCLUDE_PATH=
方法仍然很困难。有人也遇到过这个问题吗?
完全错误:
**ERROR: Command errored out with exit status 1:
command: /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/v4/cl9rby0j17gct94qgsksmw9w0000gn/T/pip-install-5ud0hb2z/cchardet/setup.py'"'"'; __file__='"'"'/private/var/folders/v4/cl9rby0j17gct94qgsksmw9w0000gn/T/pip-install-5ud0hb2z/cchardet/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/v4/cl9rby0j17gct94qgsksmw9w0000gn/T/pip-record-x2sb36vg/install-record.txt --single-version-externally-managed --compile
cwd: /private/var/folders/v4/cl9rby0j17gct94qgsksmw9w0000gn/T/pip-install-5ud0hb2z/cchardet/
Complete output (24 lines):
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/cchardet
copying src/cchardet/version.py -> build/lib.macosx-10.9-x86_64-3.7/cchardet
copying src/cchardet/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/cchardet
running build_ext
building 'cchardet._cchardet' extension
creating build/temp.macosx-10.9-x86_64-3.7
creating build/temp.macosx-10.9-x86_64-3.7/src
creating build/temp.macosx-10.9-x86_64-3.7/src/cchardet
creating build/temp.macosx-10.9-x86_64-3.7/src/ext
creating build/temp.macosx-10.9-x86_64-3.7/src/ext/uchardet
creating build/temp.macosx-10.9-x86_64-3.7/src/ext/uchardet/src
creating build/temp.macosx-10.9-x86_64-3.7/src/ext/uchardet/src/LangModels
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -Isrc/ext/uchardet/src -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c src/cchardet/_cchardet.cpp -o build/temp.macosx-10.9-x86_64-3.7/src/cchardet/_cchardet.o
In file included from src/cchardet/_cchardet.cpp:609:0:
/usr/local/include/c++/7.1.0/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
#include_next <stdlib.h>
^~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/v4/cl9rby0j17gct94qgsksmw9w0000gn/T/pip-install-5ud0hb2z/cchardet/setup.py'"'"'; __file__='"'"'/private/var/folders/v4/cl9rby0j17gct94qgsksmw9w0000gn/T/pip-install-5ud0hb2z/cchardet/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/v4/cl9rby0j17gct94qgsksmw9w0000gn/T/pip-record-x2sb36vg/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.**
答案 0 :(得分:0)
升级到Catalina后,您可能需要重新安装Xcode命令行工具:
xcode-select --install
在终端中运行以上命令,并按照提示进行操作。