此documentation之后,我正在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
之后。我仍然遇到那个错误。如果您有任何建议,请帮助我,非常感谢!
答案 0 :(得分:1)
我在homebrew core
上发现了这个comment,为我解决了这个问题。
TL; DR->
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
在安装asdf
时也遇到了这个问题。我在上面运行了命令,然后brew install asdf
工作了。我认为在macOS更新后会发生此问题,因为我必须再次运行它才能安装google-cloud-sdk
。
答案 1 :(得分:0)
安装 Developer命令行工具:
xcode-select --install
重新安装 python2 :
brew reinstall python2