mac中安装pycurl报错error: command ‘clang‘ failed with exit status 1
使用命令安装pycurl:
python3 -m pip install pycurl
报错:ERROR: Command errored out with exit status 1:
command: /Library/Developer/CommandLineTools/usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv\[0\] = '"'"'/private/var/folders/3s/kz36vylx0td922n3264rkpwr0000gn/T/pip-install-5p561uh8/pycurl\_3b8958baee0a45d8b545ecabadd39816/setup.py'"'"'; \_\_file\_\_='"'"'/private/var/folders/3s/kz36vylx0td922n3264rkpwr0000gn/T/pip-install-5p561uh8/pycurl\_3b8958baee0a45d8b545ecabadd39816/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(\_\_file\_\_) if os.path.exists(\_\_file\_\_) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\\r\\n'"'"', '"'"'\\n'"'"');f.close();exec(compile(code, \_\_file\_\_, '"'"'exec'"'"'))' install --record /private/var/folders/3s/kz36vylx0td922n3264rkpwr0000gn/T/pip-record-4m5f06ct/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /Users/yaqin/Library/Python/3.8/include/python3.8/pycurl
cwd: /private/var/folders/3s/kz36vylx0td922n3264rkpwr0000gn/T/pip-install-5p561uh8/pycurl\_3b8958baee0a45d8b545ecabadd39816/
Complete output (119 lines):
Using curl-config (libcurl 7.64.1)
Warning: libcurl is configured to use SSL, but we have not been able to determine which SSL backend it is using. If your Curl is built against OpenSSL, LibreSSL, BoringSSL, GnuTLS, NSS or mbedTLS please specify the SSL backend manually. For other SSL backends please ignore this message.Not using an SSL library
running install
running build
running build\_py
creating build
creating build/lib.macosx-10.14.6-x86\_64-3.8
creating build/lib.macosx-10.14.6-x86\_64-3.8/curl
copying python/curl/\_\_init\_\_.py -> build/lib.macosx-10.14.6-x86\_64-3.8/curl
running build\_ext
building 'pycurl' extension
creating build/temp.macosx-10.14.6-x86\_64-3.8
creating build/temp.macosx-10.14.6-x86\_64-3.8/src
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86\_64 -DPYCURL\_VERSION="7.44.1" -DHAVE\_CURL\_SSL=1 -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c src/docstrings.c -o build/temp.macosx-10.14.6-x86\_64-3.8/src/docstrings.o
In file included from src/docstrings.c:4:
In file included from src/pycurl.h:5:
In file included from /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8/Python.h:11:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/limits.h:21:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/limits.h:63:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/cdefs.h:807:2: error: Unsupported architecture
\#error Unsupported architecture
^
In file included from src/docstrings.c:4:
In file included from src/pycurl.h:5:
In file included from /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8/Python.h:11:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/limits.h:21:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/limits.h:64:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/machine/limits.h:8:2: error: architecture not supported
\#error architecture not supported
^
In file included from src/docstrings.c:4:
In file included from src/pycurl.h:5:
In file included from /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8/Python.h:25:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdio.h:64:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/\_stdio.h:71:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/\_types.h:27:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/\_types.h:33:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/machine/\_types.h:34:2: error: architecture not supported
\#error architecture not supported
^
In file included from src/docstrings.c:4:
In file included from src/pycurl.h:5:
In file included from /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8/Python.h:25:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdio.h:64:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/\_stdio.h:71:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/\_types.h:27:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/\_types.h:55:9: error: unknown type name '\_\_int64\_t'
typedef \_\_int64\_t \_\_darwin\_blkcnt\_t; /\* total blocks \*/
^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/\_types.h:56:9: error: unknown type name '\_\_int32\_t'; did you mean '\_\_int128\_t'?
typedef \_\_int32\_t \_\_darwin\_blksize\_t; /\* preferred block size \*/
^
note: '\_\_int128\_t' declared here
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/\_types.h:57:9: error: unknown type name '\_\_int32\_t'; did you mean '\_\_int128\_t'?
typedef \_\_int32\_t \_\_darwin\_dev\_t; /\* dev\_t \*/
^
note: '\_\_int128\_t' declared here
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/\_types.h:60:9: error: unknown type name '\_\_uint32\_t'; did you mean '\_\_uint128\_t'?
typedef \_\_uint32\_t \_\_darwin\_gid\_t; /\* \[???\] process and group IDs \*/
^
note: '\_\_uint128\_t' declared here
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/\_types.h:61:9: error: unknown type name '\_\_uint32\_t'; did you mean '\_\_uint128\_t'?
typedef \_\_uint32\_t \_\_darwin\_id\_t; /\* \[XSI\] pid\_t, uid\_t, or gid\_t\*/
^
note: '\_\_uint128\_t' declared here
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/\_types.h:62:9: error: unknown type name '\_\_uint64\_t'
typedef \_\_uint64\_t \_\_darwin\_ino64\_t; /\* \[???\] Used for 64 bit inodes \*/
^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/\_types.h:68:9: error: unknown type name '\_\_darwin\_natural\_t'
typedef \_\_darwin\_natural\_t \_\_darwin\_mach\_port\_name\_t; /\* Used by mach \*/
^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/\_types.h:70:9: error: unknown type name '\_\_uint16\_t'; did you mean '\_\_uint128\_t'?
typedef \_\_uint16\_t \_\_darwin\_mode\_t; /\* \[???\] Some file attributes \*/
^
note: '\_\_uint128\_t' declared here
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/\_types.h:71:9: error: unknown type name '\_\_int64\_t'
typedef \_\_int64\_t \_\_darwin\_off\_t; /\* \[???\] Used for file sizes \*/
^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/\_types.h:72:9: error: unknown type name '\_\_int32\_t'; did you mean '\_\_int128\_t'?
typedef \_\_int32\_t \_\_darwin\_pid\_t; /\* \[???\] process and group IDs \*/
^
note: '\_\_int128\_t' declared here
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/\_types.h:73:9: error: unknown type name '\_\_uint32\_t'; did you mean '\_\_uint128\_t'?
typedef \_\_uint32\_t \_\_darwin\_sigset\_t; /\* \[???\] signal set \*/
^
note: '\_\_uint128\_t' declared here
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/\_types.h:74:9: error: unknown type name '\_\_int32\_t'; did you mean '\_\_int128\_t'?
typedef \_\_int32\_t \_\_darwin\_suseconds\_t; /\* \[???\] microseconds \*/
^
note: '\_\_int128\_t' declared here
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/\_types.h:75:9: error: unknown type name '\_\_uint32\_t'; did you mean '\_\_uint128\_t'?
typedef \_\_uint32\_t \_\_darwin\_uid\_t; /\* \[???\] user IDs \*/
^
note: '\_\_uint128\_t' declared here
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/\_types.h:76:9: error: unknown type name '\_\_uint32\_t'; did you mean '\_\_uint128\_t'?
typedef \_\_uint32\_t \_\_darwin\_useconds\_t; /\* \[???\] microseconds \*/
^
note: '\_\_uint128\_t' declared here
In file included from src/docstrings.c:4:
In file included from src/pycurl.h:5:
In file included from /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8/Python.h:25:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdio.h:64:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/\_stdio.h:71:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/\_types.h:43:9: error: unknown type name '\_\_uint32\_t'; did you mean '\_\_uint128\_t'?
typedef \_\_uint32\_t \_\_darwin\_wctype\_t;
^
note: '\_\_uint128\_t' declared here
In file included from src/docstrings.c:4:
In file included from src/pycurl.h:5:
In file included from /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8/Python.h:25:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdio.h:64:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/\_stdio.h:75:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/\_types/\_va\_list.h:31:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/machine/types.h:37:2: error: architecture not supported
\#error architecture not supported
^
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: /Library/Developer/CommandLineTools/usr/bin/python3 -u -c ‘import io, os, sys, setuptools, tokenize; sys.argv[0] = ‘“‘“‘/private/var/folders/3s/kz36vylx0td922n3264rkpwr0000gn/T/pip-install-5p561uh8/pycurl_3b8958baee0a45d8b545ecabadd39816/setup.py’”‘“‘; __file__=’”‘“‘/private/var/folders/3s/kz36vylx0td922n3264rkpwr0000gn/T/pip-install-5p561uh8/pycurl_3b8958baee0a45d8b545ecabadd39816/setup.py’”‘“‘;f = getattr(tokenize, ‘“‘“‘open’”‘“‘, open)(__file__) if os.path.exists(__file__) else io.StringIO(‘“‘“‘from setuptools import setup; setup()’”‘“‘);code = f.read().replace(‘“‘“‘\r\n’”‘“‘, ‘“‘“‘\n’”‘“‘);f.close();exec(compile(code, __file__, ‘“‘“‘exec’”‘“‘))’ install —record /private/var/folders/3s/kz36vylx0td922n3264rkpwr0000gn/T/pip-record-4m5f06ct/install-record.txt —single-version-externally-managed —user —prefix= —compile —install-headers /Users/yaqin/Library/Python/3.8/include/python3.8/pycurl Check the logs for full command output.
分析原因:
从上面的报错信息可以看到最后的报错显示的是clang出现错误,所以推测应该是编译器导致的错误,因为新版本的xcode command tool默认使用的是arm版本的编译方式,而如果我们要使用x86架构,则需要通过手动设置通过环境变量指定使用特定的架构。
解决方法:
在终端输入以下命令:
export ARCHFLAGS="-arch x86_64"
然后再重新执行安装命令即可成功!
还没有评论,来说两句吧...