Mac Xcode 没有安装 python 库

Posted

技术标签:

【中文标题】Mac Xcode 没有安装 python 库【英文标题】:Mac Xcode not installing python libraries 【发布时间】:2020-10-31 08:27:24 【问题描述】:

我试图通过 pip 在我的新 mac 机器上安装 python 库。但由于某些 xcode 错误,它无法安装。我已经安装了 Xcode 应用程序和 Xcode 命令行工具。

Mac os 版本:- Catalina 10.15.7 我已经安装了最新的 xcode 命令行工具。

这里我分享命令行的回溯。

主要错误如下:

fatal error: too many errors emitted, stopping now [-ferror-limit=]
  20 errors generated.
  error: command 'xcrun' failed with exit status 1

这里我分享命令行的回溯。

3.8/twisted/internet/test
  copying src/twisted/internet/test/test_base.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/internet/test
  copying src/twisted/internet/test/test_main.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/internet/test
  copying src/twisted/internet/test/test_resolver.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/internet/test
  copying src/twisted/internet/test/test_win32serialport.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/internet/test
  copying src/twisted/internet/test/test_newtls.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/internet/test
  copying src/twisted/internet/test/test_asyncioreactor.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/internet/test
  copying src/twisted/internet/test/fakeendpoint.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/internet/test
  copying src/twisted/internet/test/test_epollreactor.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/internet/test
  copying src/twisted/internet/test/test_testing.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/internet/test
  creating build/lib.macosx-10.14.6-x86_64-3.8/twisted/scripts/test
  copying src/twisted/scripts/test/__init__.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/scripts/test
  copying src/twisted/scripts/test/test_scripts.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/scripts/test
  creating build/lib.macosx-10.14.6-x86_64-3.8/twisted/application/test
  copying src/twisted/application/test/test_service.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/application/test
  copying src/twisted/application/test/__init__.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/application/test
  copying src/twisted/application/test/test_internet.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/application/test
  creating build/lib.macosx-10.14.6-x86_64-3.8/twisted/application/runner
  copying src/twisted/application/runner/_pidfile.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/application/runner
  copying src/twisted/application/runner/_exit.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/application/runner
  copying src/twisted/application/runner/__init__.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/application/runner
  copying src/twisted/application/runner/_runner.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/application/runner
  creating build/lib.macosx-10.14.6-x86_64-3.8/twisted/application/twist
  copying src/twisted/application/twist/_options.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/application/twist
  copying src/twisted/application/twist/_twist.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/application/twist
  copying src/twisted/application/twist/__init__.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/application/twist
  creating build/lib.macosx-10.14.6-x86_64-3.8/twisted/application/runner/test
  copying src/twisted/application/runner/test/test_pidfile.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/application/runner/test
  copying src/twisted/application/runner/test/__init__.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/application/runner/test
  copying src/twisted/application/runner/test/test_runner.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/application/runner/test
  copying src/twisted/application/runner/test/test_exit.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/application/runner/test
  creating build/lib.macosx-10.14.6-x86_64-3.8/twisted/application/twist/test
  copying src/twisted/application/twist/test/test_options.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/application/twist/test
  copying src/twisted/application/twist/test/__init__.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/application/twist/test
  copying src/twisted/application/twist/test/test_twist.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/application/twist/test
  creating build/lib.macosx-10.14.6-x86_64-3.8/twisted/protocols/test
  copying src/twisted/protocols/test/test_basic.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/protocols/test
  copying src/twisted/protocols/test/__init__.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/protocols/test
  copying src/twisted/protocols/test/test_tls.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/protocols/test
  creating build/lib.macosx-10.14.6-x86_64-3.8/twisted/protocols/haproxy
  copying src/twisted/protocols/haproxy/_wrapper.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/protocols/haproxy
  copying src/twisted/protocols/haproxy/_v2parser.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/protocols/haproxy
  copying src/twisted/protocols/haproxy/_info.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/protocols/haproxy
  copying src/twisted/protocols/haproxy/__init__.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/protocols/haproxy
  copying src/twisted/protocols/haproxy/_interfaces.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/protocols/haproxy
  copying src/twisted/protocols/haproxy/_parser.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/protocols/haproxy
  copying src/twisted/protocols/haproxy/_v1parser.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/protocols/haproxy
  copying src/twisted/protocols/haproxy/_exceptions.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/protocols/haproxy
  creating build/lib.macosx-10.14.6-x86_64-3.8/twisted/protocols/haproxy/test
  copying src/twisted/protocols/haproxy/test/test_parser.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/protocols/haproxy/test
  copying src/twisted/protocols/haproxy/test/test_wrapper.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/protocols/haproxy/test
  copying src/twisted/protocols/haproxy/test/test_v2parser.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/protocols/haproxy/test
  copying src/twisted/protocols/haproxy/test/__init__.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/protocols/haproxy/test
  copying src/twisted/protocols/haproxy/test/test_v1parser.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/protocols/haproxy/test
  creating build/lib.macosx-10.14.6-x86_64-3.8/twisted/pair/test
  copying src/twisted/pair/test/test_tuntap.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/pair/test
  copying src/twisted/pair/test/__init__.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/pair/test
  copying src/twisted/pair/test/test_rawudp.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/pair/test
  copying src/twisted/pair/test/test_ip.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/pair/test
  copying src/twisted/pair/test/test_ethernet.py -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/pair/test
  running egg_info
  writing src/Twisted.egg-info/PKG-INFO
  writing dependency_links to src/Twisted.egg-info/dependency_links.txt
  writing entry points to src/Twisted.egg-info/entry_points.txt
  writing requirements to src/Twisted.egg-info/requires.txt
  writing top-level names to src/Twisted.egg-info/top_level.txt
  reading manifest file 'src/Twisted.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no previously-included files matching '*.misc' found under directory 'src/twisted'
  warning: no previously-included files matching '*.bugfix' found under directory 'src/twisted'
  warning: no previously-included files matching '*.doc' found under directory 'src/twisted'
  warning: no previously-included files matching '*.feature' found under directory 'src/twisted'
  warning: no previously-included files matching '*.removal' found under directory 'src/twisted'
  warning: no previously-included files matching 'NEWS' found under directory 'src/twisted'
  warning: no previously-included files matching 'README' found under directory 'src/twisted'
  warning: no previously-included files matching 'newsfragments' found under directory 'src/twisted'
  warning: no previously-included files found matching 'src/twisted/topfiles/CREDITS'
  warning: no previously-included files found matching 'src/twisted/topfiles/ChangeLog.Old'
  warning: no previously-included files found matching 'pyproject.toml'
  warning: no previously-included files found matching 'codecov.yml'
  warning: no previously-included files found matching 'appveyor.yml'
  warning: no previously-included files found matching '.coveralls.yml'
  warning: no previously-included files found matching '.circleci'
  warning: no previously-included files matching '*' found under directory '.circleci'
  no previously-included directories found matching 'bin'
  no previously-included directories found matching 'admin'
  no previously-included directories found matching '.travis'
  no previously-included directories found matching '.github'
  warning: no previously-included files found matching 'docs/historic/2003'
  warning: no previously-included files matching '*' found under directory 'docs/historic/2003'
  writing manifest file 'src/Twisted.egg-info/SOURCES.txt'
  copying src/twisted/test/cert.pem.no_trailing_newline -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/test
  copying src/twisted/test/key.pem.no_trailing_newline -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/test
  copying src/twisted/test/server.pem -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/test
  copying src/twisted/test/test_defer.py.3only -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/test
  copying src/twisted/python/twisted-completion.zsh -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/python
  creating build/lib.macosx-10.14.6-x86_64-3.8/twisted/python/_pydoctortemplates
  copying src/twisted/python/_pydoctortemplates/common.html -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/python/_pydoctortemplates
  copying src/twisted/python/_pydoctortemplates/index.html -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/python/_pydoctortemplates
  copying src/twisted/python/_pydoctortemplates/summary.html -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/python/_pydoctortemplates
  copying src/twisted/words/xish/xpathparser.g -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/words/xish
  copying src/twisted/words/im/instancemessenger.glade -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/words/im
  copying src/twisted/python/test/_deprecatetests.py.3only -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/python/test
  copying src/twisted/mail/test/rfc822.message -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/mail/test
  copying src/twisted/trial/test/_assertiontests.py.3only -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/trial/test
  copying src/twisted/internet/iocpreactor/notes.txt -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/internet/iocpreactor
  copying src/twisted/internet/test/_awaittests.py.3only -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/internet/test
  copying src/twisted/internet/test/_yieldfromtests.py.3only -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/internet/test
  creating build/lib.macosx-10.14.6-x86_64-3.8/twisted/internet/test/fake_CAs
  copying src/twisted/internet/test/fake_CAs/chain.pem -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/internet/test/fake_CAs
  copying src/twisted/internet/test/fake_CAs/not-a-certificate -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/internet/test/fake_CAs
  copying src/twisted/internet/test/fake_CAs/thing1.pem -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/internet/test/fake_CAs
  copying src/twisted/internet/test/fake_CAs/thing2-duplicate.pem -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/internet/test/fake_CAs
  copying src/twisted/internet/test/fake_CAs/thing2.pem -> build/lib.macosx-10.14.6-x86_64-3.8/twisted/internet/test/fake_CAs
  running build_ext
  building 'twisted.test.raiser' extension
  creating build/temp.macosx-10.14.6-x86_64-3.8
  creating build/temp.macosx-10.14.6-x86_64-3.8/src
  creating build/temp.macosx-10.14.6-x86_64-3.8/src/twisted
  creating build/temp.macosx-10.14.6-x86_64-3.8/src/twisted/test
  xcrun -sdk macosx 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 -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c src/twisted/test/raiser.c -o build/temp.macosx-10.14.6-x86_64-3.8/src/twisted/test/raiser.o
  In file included from src/twisted/test/raiser.c:4:
  In file included from /Applications/Xcode.app/Contents/Developer/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/MacOSX.sdk/usr/include/limits.h:63:
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:807:2: error: Unsupported architecture
  #error Unsupported architecture
   ^
  In file included from src/twisted/test/raiser.c:4:
  In file included from /Applications/Xcode.app/Contents/Developer/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/MacOSX.sdk/usr/include/limits.h:64:
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/machine/limits.h:8:2: error: architecture not supported
  #error architecture not supported
   ^
  In file included from src/twisted/test/raiser.c:4:
  In file included from /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8/Python.h:25:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:64:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:71:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_types.h:27:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:33:
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/machine/_types.h:34:2: error: architecture not supported
  #error architecture not supported
   ^
  In file included from src/twisted/test/raiser.c:4:
  In file included from /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8/Python.h:25:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:64:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:71:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_types.h:27:
  /Library/Developer/CommandLineTools/SDKs/MacOSX.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/MacOSX.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/MacOSX.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/MacOSX.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/MacOSX.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/MacOSX.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/MacOSX.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/MacOSX.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/MacOSX.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/MacOSX.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/MacOSX.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/MacOSX.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/MacOSX.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/MacOSX.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/twisted/test/raiser.c:4:
  In file included from /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8/Python.h:25:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:64:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:71:
  /Library/Developer/CommandLineTools/SDKs/MacOSX.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/twisted/test/raiser.c:4:
  In file included from /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8/Python.h:25:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:64:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:75:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_va_list.h:31:
  /Library/Developer/CommandLineTools/SDKs/MacOSX.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 'xcrun' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for Twisted

【问题讨论】:

【参考方案1】:

设置以下环境变量后解决了。

export ARCHFLAGS="-arch x86_64"

【讨论】:

以上是关于Mac Xcode 没有安装 python 库的主要内容,如果未能解决你的问题,请参考以下文章

带有 Python 2.6.7 的 Mac OS X 10.6.7 中 twitter.py 文件(python-twitter 库)的位置

Mac中python的安装路径 Django 的 django-admin.py添加环境变量

安装了 Xcode 命令行工具的 Mac OS X 中的 clang-format 和 clang-format.py 在哪里?

mac运行python项目

mac 下python安装在哪

ptython问题