升级到OSX Mojave(Developer beta 2)之后,每次使用GCP以及重新安装GCP都会出现错误。
ERROR: gcloud failed to load: No module named zlib
gcloud_main = _import_gcloud_main()
import googlecloudsdk.gcloud_main
from googlecloudsdk.calliope import base
from googlecloudsdk.calliope import display
from googlecloudsdk.calliope import display_taps
from googlecloudsdk.core.resource import resource_printer_base
from googlecloudsdk.core.resource import resource_projector
from apitools.base.py import encoding as protorpc_encoding
from apitools.base.py.base_api import *
from apitools.base.py import http_wrapper
import httplib2
from httplib2.python2.httplib2 import *
import gzip
import zlib
我试图通过brew重新安装python和zlib。但这没用。
答案 0 :(得分:4)
根据发行说明的第3页:https://download.developer.apple.com/Developer_Tools/Xcode_10_beta_3/Release_Notes_for_Xcode_10_beta_3.pdf,首先需要在/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
安装软件包。 open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
然后,您需要从brew重新安装python2:
brew reinstall python2
之后,您可以brew cask install google-cloud-sdk
,它将起作用