macOS Catalina 或 Big Sur 上的“import cppyy”异常

Exception at `import cppyy` on macOS Catalina or Big Sur

非常简单的解释 - 我可以 pip install copy 但是任何 python 文件中的 import cppyy 都会抛出大量异常:

(Re-)building pre-compiled headers (options: -O2 -mavx); this may take a minute ...
ERROR in cling::CIFactory::createCI(): cannot extract standard library include paths!
Invoking:
  LC_ALL=C /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++   -O2 -DNDEBUG -xc++ -E -v /dev/null 2>&1 | sed -n -e '/^.*include/,${' -e '/^ \/.*++/p' -e '}'
Results was:
With exit code 0
Warning: sysroot "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" not found (ignoring for now).input_line_1:1:10: fatal error: 'new' file not found
#include <new>
         ^~~~~
Warning in cling::IncrementalParser::CheckABICompatibility():
  Failed to extract C++ standard library version.
In file included from input_line_3:1:
In file included from ./include/RtypesCore.h:23:
/Users/chris/.pyenv/versions/3.8.2/lib/python3.8/site-packages/cppyy_backend/etc//cling/lib/clang/5.0.0/include/stddef.h:51:9: error: unknown type name '__PTRDIFF_TYPE__'
typedef __PTRDIFF_TYPE__ ptrdiff_t;
        ^
/Users/chris/.pyenv/versions/3.8.2/lib/python3.8/site-packages/cppyy_backend/etc//cling/lib/clang/5.0.0/include/stddef.h:62:9: error: unknown type name '__SIZE_TYPE__'
typedef __SIZE_TYPE__ size_t;
        ^
/Users/chris/.pyenv/versions/3.8.2/lib/python3.8/site-packages/cppyy_backend/etc//cling/lib/clang/5.0.0/include/stddef.h:90:9: error: unknown type name '__WCHAR_TYPE__'
typedef __WCHAR_TYPE__ wchar_t;
        ^
/Users/chris/.pyenv/versions/3.8.2/lib/python3.8/site-packages/cppyy_backend/etc//cling/lib/clang/5.0.0/include/stddef.h:90:24: error: expected unqualified-id
typedef __WCHAR_TYPE__ wchar_t;
                       ^
input_line_3:2:10: fatal error: 'string' file not found
#include <string>
         ^~~~~~~~
0  libCling.so              0x00000001081728c5 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  libCling.so              0x0000000108172eb6 SignalHandler(int) + 598
2  libsystem_platform.dylib 0x00007fff20356d7d _sigtramp + 29
3  libsystem_platform.dylib 000000000000000000 _sigtramp + 3754594976
4  libCling.so              0x00000001062d4cb8 CppyyLegacy::TMetaUtils::TNormalizedCtxt::TNormalizedCtxt(cling::LookupHelper const&) + 40
5  libCling.so              0x000000010638b70c CppyyLegacy::TCling::TCling(char const*, char const*, char const* const*) + 12380
6  libCling.so              0x0000000106384425 CreateInterpreter + 53
7  libCoreLegacy.so         0x0000000108f1f296 CppyyLegacy::TROOT::InitInterpreter() + 214
8  libCoreLegacy.so         0x0000000108f1f172 CppyyLegacy::Internal::GetROOT2() + 34
9  libCling.so              0x000000010636904d TCling__GetInterpreter + 61
10 libCling.so              0x00000001063331e7 RootClingMain(int, char**, bool) + 18855
11 libCling.so              0x0000000106342ce4 ROOT_rootcling_Driver + 340
12 rootcling                0x0000000105f3cf5e main + 142
13 libdyld.dylib            0x00007fff2032d631 start + 1
Stack dump:
0.  Program arguments: ./bin/rootcling -rootbuild -generate-pch -f allDict.cxx -noDictSelection -D__CLING__ -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DROOT_PCH -I./include -I./etc -I./etc/dictpch -I./etc/cling -std=c++17 -m64 -pipe -fsigned-char -fno-common -Qunused-arguments -pthread -stdlib=libc++ -I/Users/chris/.pyenv/versions/3.8.2/lib/python3.8/site-packages/cppyy_backend/include etc/dictpch/allHeaders.h etc/dictpch/allLinkDefs.h
[/usr/lib/system/libsystem_platform.dylib] _sigtramp (no debug info)
[<unknown binary>] (no debug info)
[/Users/chris/.pyenv/versions/3.8.2/lib/python3.8/site-packages/cppyy_backend/lib/libCling.so] CppyyLegacy::TMetaUtils::TNormalizedCtxt::TNormalizedCtxt(cling::LookupHelper const&) (no debug info)
[/Users/chris/.pyenv/versions/3.8.2/lib/python3.8/site-packages/cppyy_backend/lib/libCling.so] CppyyLegacy::TCling::TCling(char const*, char const*, char const* const*) (no debug info)
[/Users/chris/.pyenv/versions/3.8.2/lib/python3.8/site-packages/cppyy_backend/lib/libCling.so] CreateInterpreter (no debug info)
[/Users/chris/.pyenv/versions/3.8.2/lib/python3.8/site-packages/cppyy_backend/lib/libCoreLegacy.so] CppyyLegacy::TROOT::InitInterpreter() (no debug info)
[/Users/chris/.pyenv/versions/3.8.2/lib/python3.8/site-packages/cppyy_backend/lib/libCoreLegacy.so] CppyyLegacy::Internal::GetROOT2() (no debug info)
[/Users/chris/.pyenv/versions/3.8.2/lib/python3.8/site-packages/cppyy_backend/lib/libCling.so] TCling__GetInterpreter (no debug info)
[/Users/chris/.pyenv/versions/3.8.2/lib/python3.8/site-packages/cppyy_backend/lib/libCling.so] RootClingMain(int, char**, bool) (no debug info)
[/Users/chris/.pyenv/versions/3.8.2/lib/python3.8/site-packages/cppyy_backend/lib/libCling.so] ROOT_rootcling_Driver (no debug info)
[/Users/chris/.pyenv/versions/3.8.2/lib/python3.8/site-packages/cppyy_backend/./bin/rootcling] main (no debug info)
[/usr/lib/system/libdyld.dylib] start (no debug info)

我错过了什么?我已经完成 xcode-select --install 但它现在似乎不喜欢我的电脑。

问题(正如 Wim 在评论中指出的那样)Xcode 需要安装才能在 macOS 上 import cppyy