如何解决适用于Mac的Gcloud SDK安装
我在Mac上安装gcloud sdk时遇到问题。执行./install.sh
时出现以下错误。来源:https://cloud.google.com/sdk/docs/quickstart
Welcome to the Google Cloud SDK!
Traceback (most recent call last):
File "/Users/kevin/Downloads/google-cloud-sdk/bin/bootstrapping/install.py",line 12,in <module>
import bootstrapping
File "/Users/kevin/Downloads/google-cloud-sdk/bin/bootstrapping/bootstrapping.py",line 32,in <module>
import setup # pylint:disable=g-import-not-at-top
File "/Users/kevin/Downloads/google-cloud-sdk/bin/bootstrapping/setup.py",line 57,in <module>
from googlecloudsdk.core.util import platforms
File "/Users/kevin/Downloads/google-cloud-sdk/lib/googlecloudsdk/__init__.py",line 23,in <module>
from googlecloudsdk.core.util import importing
File "/Users/kevin/Downloads/google-cloud-sdk/lib/googlecloudsdk/core/util/importing.py",in <module>
import imp
File "/Users/kevin/.pyenv/versions/3.9.0/lib/python3.9/imp.py",in <module>
from importlib import util
File "/Users/kevin/.pyenv/versions/3.9.0/lib/python3.9/importlib/util.py",line 2,in <module>
from . import abc
File "/Users/kevin/.pyenv/versions/3.9.0/lib/python3.9/importlib/abc.py",line 17,in <module>
from typing import Protocol,runtime_checkable
File "/Users/kevin/.pyenv/versions/3.9.0/lib/python3.9/typing.py",line 26,in <module>
import re as stdlib_re # Avoid confusion with the re we export.
File "/Users/kevin/.pyenv/versions/3.9.0/lib/python3.9/re.py",line 124,in <module>
import enum
File "/Users/kevin/Downloads/google-cloud-sdk/lib/third_party/enum/__init__.py",in <module>
spec = importlib.util.find_spec('enum')
AttributeError: module 'importlib' has no attribute 'util'
当我做gcloud init
Traceback (most recent call last):
File "/Users/kevin/Downloads/google-cloud-sdk/lib/gcloud.py",line 104,in <module>
main()
File "/Users/kevin/Downloads/google-cloud-sdk/lib/gcloud.py",line 62,in main
from googlecloudsdk.core.util import encoding
File "/Users/kevin/Downloads/google-cloud-sdk/lib/googlecloudsdk/__init__.py",in <module>
spec = importlib.util.find_spec('enum')
AttributeError: module 'importlib' has no attribute 'util'
我认为这是Python问题。但是我正在运行Python3:
python -V
显示
Python 3.9.0
我已经用自制软件安装了它。
可能是什么问题?
解决方法
这是Mac,Windows和Linux上的一个已知问题:https://issuetracker.google.com/170125513。
我建议使用提到的here(3.5至3.8)推荐的Python版本。
这不仅会影响Cloud SDK,也会影响其他因素(例如,here所述)。
,感谢您的回答。实际上,它可以与python 3.8.6版本一起使用。 我会添加一些信息,如果它可以帮助某人。为了管理python版本,我使用了pyenv并安装了所需的python版本。
pyenv install 3.8.6
pyenv global 3.8.6
,
如果要快速修复,可以将其添加到bash配置文件中并重新启动终端:
export CLOUDSDK_PYTHON=python3.8
为我工作
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。