mac中安装pycurl报错error: command ‘clang‘ failed with exit status 1

冷不防 2022-09-07 12:22 332阅读 0赞

使用命令安装pycurl:

  1. python3 -m pip install pycurl

报错:ERROR: Command errored out with exit status 1:

  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
  2. cwd: /private/var/folders/3s/kz36vylx0td922n3264rkpwr0000gn/T/pip-install-5p561uh8/pycurl\_3b8958baee0a45d8b545ecabadd39816/
  3. Complete output (119 lines):
  4. Using curl-config (libcurl 7.64.1)
  5. 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
  6. running install
  7. running build
  8. running build\_py
  9. creating build
  10. creating build/lib.macosx-10.14.6-x86\_64-3.8
  11. creating build/lib.macosx-10.14.6-x86\_64-3.8/curl
  12. copying python/curl/\_\_init\_\_.py -> build/lib.macosx-10.14.6-x86\_64-3.8/curl
  13. running build\_ext
  14. building 'pycurl' extension
  15. creating build/temp.macosx-10.14.6-x86\_64-3.8
  16. creating build/temp.macosx-10.14.6-x86\_64-3.8/src
  17. 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
  18. In file included from src/docstrings.c:4:
  19. In file included from src/pycurl.h:5:
  20. In file included from /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8/Python.h:11:
  21. In file included from /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/limits.h:21:
  22. In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/limits.h:63:
  23. /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/cdefs.h:807:2: error: Unsupported architecture
  24. \#error Unsupported architecture
  25. ^
  26. In file included from src/docstrings.c:4:
  27. In file included from src/pycurl.h:5:
  28. In file included from /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8/Python.h:11:
  29. In file included from /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/limits.h:21:
  30. In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/limits.h:64:
  31. /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/machine/limits.h:8:2: error: architecture not supported
  32. \#error architecture not supported
  33. ^
  34. In file included from src/docstrings.c:4:
  35. In file included from src/pycurl.h:5:
  36. In file included from /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8/Python.h:25:
  37. In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdio.h:64:
  38. In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/\_stdio.h:71:
  39. In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/\_types.h:27:
  40. In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/\_types.h:33:
  41. /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/machine/\_types.h:34:2: error: architecture not supported
  42. \#error architecture not supported
  43. ^
  44. In file included from src/docstrings.c:4:
  45. In file included from src/pycurl.h:5:
  46. In file included from /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8/Python.h:25:
  47. In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdio.h:64:
  48. In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/\_stdio.h:71:
  49. In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/\_types.h:27:
  50. /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/\_types.h:55:9: error: unknown type name '\_\_int64\_t'
  51. typedef \_\_int64\_t \_\_darwin\_blkcnt\_t; /\* total blocks \*/
  52. ^
  53. /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'?
  54. typedef \_\_int32\_t \_\_darwin\_blksize\_t; /\* preferred block size \*/
  55. ^
  56. note: '\_\_int128\_t' declared here
  57. /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'?
  58. typedef \_\_int32\_t \_\_darwin\_dev\_t; /\* dev\_t \*/
  59. ^
  60. note: '\_\_int128\_t' declared here
  61. /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'?
  62. typedef \_\_uint32\_t \_\_darwin\_gid\_t; /\* \[???\] process and group IDs \*/
  63. ^
  64. note: '\_\_uint128\_t' declared here
  65. /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'?
  66. typedef \_\_uint32\_t \_\_darwin\_id\_t; /\* \[XSI\] pid\_t, uid\_t, or gid\_t\*/
  67. ^
  68. note: '\_\_uint128\_t' declared here
  69. /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/\_types.h:62:9: error: unknown type name '\_\_uint64\_t'
  70. typedef \_\_uint64\_t \_\_darwin\_ino64\_t; /\* \[???\] Used for 64 bit inodes \*/
  71. ^
  72. /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/\_types.h:68:9: error: unknown type name '\_\_darwin\_natural\_t'
  73. typedef \_\_darwin\_natural\_t \_\_darwin\_mach\_port\_name\_t; /\* Used by mach \*/
  74. ^
  75. /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'?
  76. typedef \_\_uint16\_t \_\_darwin\_mode\_t; /\* \[???\] Some file attributes \*/
  77. ^
  78. note: '\_\_uint128\_t' declared here
  79. /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/\_types.h:71:9: error: unknown type name '\_\_int64\_t'
  80. typedef \_\_int64\_t \_\_darwin\_off\_t; /\* \[???\] Used for file sizes \*/
  81. ^
  82. /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'?
  83. typedef \_\_int32\_t \_\_darwin\_pid\_t; /\* \[???\] process and group IDs \*/
  84. ^
  85. note: '\_\_int128\_t' declared here
  86. /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'?
  87. typedef \_\_uint32\_t \_\_darwin\_sigset\_t; /\* \[???\] signal set \*/
  88. ^
  89. note: '\_\_uint128\_t' declared here
  90. /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'?
  91. typedef \_\_int32\_t \_\_darwin\_suseconds\_t; /\* \[???\] microseconds \*/
  92. ^
  93. note: '\_\_int128\_t' declared here
  94. /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'?
  95. typedef \_\_uint32\_t \_\_darwin\_uid\_t; /\* \[???\] user IDs \*/
  96. ^
  97. note: '\_\_uint128\_t' declared here
  98. /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'?
  99. typedef \_\_uint32\_t \_\_darwin\_useconds\_t; /\* \[???\] microseconds \*/
  100. ^
  101. note: '\_\_uint128\_t' declared here
  102. In file included from src/docstrings.c:4:
  103. In file included from src/pycurl.h:5:
  104. In file included from /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8/Python.h:25:
  105. In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdio.h:64:
  106. In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/\_stdio.h:71:
  107. /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/\_types.h:43:9: error: unknown type name '\_\_uint32\_t'; did you mean '\_\_uint128\_t'?
  108. typedef \_\_uint32\_t \_\_darwin\_wctype\_t;
  109. ^
  110. note: '\_\_uint128\_t' declared here
  111. In file included from src/docstrings.c:4:
  112. In file included from src/pycurl.h:5:
  113. In file included from /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8/Python.h:25:
  114. In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdio.h:64:
  115. In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/\_stdio.h:75:
  116. In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/\_types/\_va\_list.h:31:
  117. /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/machine/types.h:37:2: error: architecture not supported
  118. \#error architecture not supported
  119. ^
  120. fatal error: too many errors emitted, stopping now \[-ferror-limit=\]
  121. 20 errors generated.
  122. error: command 'clang' failed with exit status 1
  123. ----------------------------------------

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架构,则需要通过手动设置通过环境变量指定使用特定的架构。

解决方法:

在终端输入以下命令:

  1. export ARCHFLAGS="-arch x86_64"

然后再重新执行安装命令即可成功!

watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM3MjUzNTQw_size_16_color_FFFFFF_t_70

发表评论

表情:
评论列表 (有 0 条评论,332人围观)

还没有评论,来说两句吧...

相关阅读