[英]“ImportError: No module named zlib” when install google cloud sdk
I'm installing google cloud sdk on mac following this documentation . 我正在按照此文档在mac上安装google cloud sdk。 But I failed when trying to run this command: 但是在尝试运行此命令时失败了:
$ curl https://sdk.cloud.google.com | bash
And this is error: 这是错误:
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
I tried with Homebrew
but same error: 我尝试使用Homebrew
但同样的错误:
brew cask install google-cloud-sdk
And even after install zlib
via brew install zlib
. 即使安装后zlib
通过brew install zlib
。 I still got that error. 我仍然有这个错误。 Please help me if you have any suggestions, thanks a lot ! 如果您有任何建议,请帮助我,非常感谢!
I found this comment on homebrew core
that fixed it for me. 我发现这篇关于homebrew core
评论为我修复了它。
TL;DR -> sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
TL; DR - > sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
I had this issue when installing asdf
as well. 安装asdf
时我遇到了这个问题。 I ran the command above and then brew install asdf
worked. 我运行上面的命令然后brew install asdf
工作。 I think this issue happens after a macOS update because I had to run it again to install google-cloud-sdk
. 我认为这个问题发生在macOS更新之后,因为我不得不再次运行它来安装google-cloud-sdk
。
Install Developer Command Line Tools : 安装开发人员命令行工具 :
xcode-select --install
Reinstall python2 : 重新安装python2 :
brew reinstall python2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.