安装Cloud SDK错误(MacOS)— ImportError:没有名为zlib的模块

时间:2019-07-28 19:32:37

标签: google-cloud-sdk

我正在使用Terminal在Macbook上设置Cloud SDK。

我正在按照以下步骤操作:https://cloud.google.com/sdk/docs/quickstart-macos

尝试“ ./google-cloud-sdk/install.sh”命令时,出现此错误:

Ashwins-Mac:~ ashwinchalaka$ cd Downloads/
Ashwins-Mac:Downloads ashwinchalaka$ ./google-cloud-sdk/install.sh
Welcome to the Google Cloud SDK!
Traceback (most recent call last):
  File "/Users/ashwinchalaka/Downloads/./google-cloud-sdk/bin/bootstrapping/install.py", line 12, in <module>
    import bootstrapping
  File "/Users/ashwinchalaka/Downloads/google-cloud-sdk/bin/bootstrapping/bootstrapping.py", line 44, in <module>
    from googlecloudsdk.core.credentials import store as c_store
  File "/Users/ashwinchalaka/Downloads/google-cloud-sdk/lib/googlecloudsdk/core/credentials/store.py", line 33, in <module>
    from googlecloudsdk.core import http
  File "/Users/ashwinchalaka/Downloads/google-cloud-sdk/lib/googlecloudsdk/core/http.py", line 29, in <module>
    from googlecloudsdk.core import http_proxy
  File "/Users/ashwinchalaka/Downloads/google-cloud-sdk/lib/googlecloudsdk/core/http_proxy.py", line 26, in <module>
    import httplib2
  File "/Users/ashwinchalaka/Downloads/google-cloud-sdk/lib/third_party/httplib2/__init__.py", line 18, in <module>
    from httplib2.python2.httplib2 import *
  File "/Users/ashwinchalaka/Downloads/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

我要做的就是设置SDK,以便将Python-Django应用程序部署到GCP。

我已经尝试了其他论坛的许多建议。重新安装python(使用brew),尝试sudo安装zlib文件。感觉就像我一团糟,我不确定如何清理它。

1 个答案:

答案 0 :(得分:0)

在命令行中尝试此操作(安装xcode):

xcode-select --install

它应该包含zlib。然后尝试重新运行./google-cloud-sdk/install.sh。 希望对您有所帮助。