我想在 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
我见过其他类似的案例,但它们并没有解决我的问题。我试过:最佳答案
尝试在之前添加这些 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/