生成python包时未找到MacOS生成问题lstdc++

生成python包时未找到MacOS生成问题lstdc++,python,macos,clang,homebrew,Python,Macos,Clang,Homebrew,在尝试在MacOS上安装python依赖项时,我遇到了一个构建错误 clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated] ld: library not found for -lstdc++ clang: error: linker command failed with exit code 1

在尝试在MacOS上安装python依赖项时,我遇到了一个构建错误

    clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
    ld: library not found for -lstdc++
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    error: command 'g++' failed with exit status 1
我已经安装了xcode和xcode命令行工具,并且我使用homebrew,因此我已经通过homebrew安装了gcc 9.1

我在构建中看到的另一个值得关注的事情是:

  ERROR: running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.7-x86_64-3.7

我担心的是我不确定macosx-10.7指的是什么?我正在运行mojave 10.14,xcode是10.2.1版,那么10.7指的是什么呢?

令人惊讶的是,这似乎为bash提供了窍门:

导出MACOSX_部署_目标=10.9

我仍然不确定10.7和10.9是什么,但错误日志中的这一行:

move to libc++ with a minimum deployment target of OS X 10.9

让我发现导出部署目标有效地满足了它的要求

您可能希望通过自制安装gcc来安装这些Python依赖项;它自己的libstdc++不会有问题。在构建gcc时,您可以尝试将gcc路径放在路径的前面;或者调整setup.py。我认为10.7是非常通用的,表示任何与10.7及以上兼容的东西。但这只是一个猜测。值得一提的是:我在MacOS 10.14.4的机器上看到了build/lib.macosx-10.13-x86_64-3.7。这是一个C/Cython扩展,没有C++。