python-3.x - 在 Mac OS 上安装 Pip 出现错误 : command '/usr/bin/clang' failed with exit code 1

标签 python-3.x macos google-cloud-platform pip google-cloud-pubsub

我想在 Mac OS 上通过 pip 安装来安装 google-cloud-pubsub,但出现错误:distutils.errors.CompileError: command '/usr/bin/clang' failed with exit code 1 .我运行的命令:pip install google-cloud-pubsub==2.1.0 .
这里是完整的error message .
有什么建议吗?谢谢!
更多信息:

$ python -V
Python 3.9.0

$ pip -V
pip 20.2.4 from /.../lib/python3.9/site-packages/pip (python 3.9)

$ sw_vers
ProductName:    macOS
ProductVersion: 11.0.1
BuildVersion:   20B29
我见过其他类似的案例,但它们并没有解决我的问题。我试过:
  • Pip install error in Mac OS(error: command '/usr/bin/clang' failed with exit status 1)
  • Mac OS Mojave installation error - error: command 'clang' failed with exit status 1
  • 最佳答案

    尝试在之前添加这些 env var

    GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=true GRPC_PYTHON_BUILD_SYSTEM_ZLIB=true pip install google-cloud-pubsub==2.1.0
    
    如果它不起作用,您可以尝试使用 virtualenv:
    pip install virtualenv
    virtualenv my-test-env
    source my-test-env/bin/activate
    my-test-env/bin/pip install google-cloud-pubsub==2.1.0
    
    因为写在github :

    Install this library in a virtualenv using pip. virtualenv is a tool to create isolated Python environments. The basic problem it addresses is one of dependencies and versions, and indirectly permissions.


    With virtualenv, it's possible to install this library without needing system install permissions, and without clashing with the installed system dependencies.

    关于python-3.x - 在 Mac OS 上安装 Pip 出现错误 : command '/usr/bin/clang' failed with exit code 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64881510/

    相关文章:

    python - 值错误 : 'vertices' must be a 2D list or array with shape Nx2

    swift - Xcode - 由于 NSWindow.StyleMask,字体呈现不同

    android - 解析与谷歌云

    google-cloud-platform - 如何通过日志查询获取最近1小时的日志结果?

    python - 让不和谐的机器人每 10 秒改变一次播放状态

    python - 如何打印到 .txt

    python - Streamlabs API 405 响应代码

    python-3.x - Python 3 和 Tkinter 有问题且缓慢

    macos - Mac 操作系统 : ld: library not found for -lglfw

    kubernetes - 具有 1 个 CPU 不足错误的 GCloud kubernetes 集群