安装谷歌云SDK时"ImportError: No module named zlib"



我正在按照本文档在Mac上安装Google Cloud SDK。但是我在尝试运行此命令时失败了:

$ curl https://sdk.cloud.google.com | bash

这是错误:

Welcome to the Google Cloud SDK!
Traceback (most recent call last):
  File "/Users/tran.ba.vinh.son/google-cloud-sdk/bin/bootstrapping/install.py", line 12, in <module>
    import bootstrapping
  File "/Users/tran.ba.vinh.son/google-cloud-sdk/bin/bootstrapping/bootstrapping.py", line 44, in <module>
    from googlecloudsdk.core.credentials import store as c_store
  File "/Users/tran.ba.vinh.son/google-cloud-sdk/lib/googlecloudsdk/core/credentials/store.py", line 32, in <module>
    from googlecloudsdk.core import http
  File "/Users/tran.ba.vinh.son/google-cloud-sdk/lib/googlecloudsdk/core/http.py", line 31, in <module>
    from googlecloudsdk.core import http_proxy
  File "/Users/tran.ba.vinh.son/google-cloud-sdk/lib/googlecloudsdk/core/http_proxy.py", line 26, in <module>
    import httplib2
  File "/Users/tran.ba.vinh.son/google-cloud-sdk/lib/third_party/httplib2/__init__.py", line 18, in <module>
    from httplib2.python2.httplib2 import *
  File "/Users/tran.ba.vinh.son/google-cloud-sdk/lib/third_party/httplib2/python2/httplib2/__init__.py", line 35, in <module>
    import gzip
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/gzip.py", line 9, in <module>
    import zlib
ImportError: No module named zlib

我尝试了Homebrew但相同的错误:

brew cask install google-cloud-sdk

即使在安装后zlib通过brew install zlib.我仍然收到那个错误。如果您有任何建议,请帮助我,非常感谢!

我在为我修复它的homebrew core上找到了这条评论。

博士 -> sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

我在安装 asdf 时也遇到了这个问题。我运行了上面的命令,然后brew install asdf工作了。我认为此问题发生在macOS更新之后,因为我必须再次运行它才能安装google-cloud-sdk

安装开发人员命令行工具

xcode-select --install

重新安装 python2

brew reinstall python2    

相关内容

  • 没有找到相关文章

最新更新