我一直很高兴地在我的macbook上使用gcloud cli,运行在macOS蒙特雷12.4版上。
我做了一个brew upgrade,它似乎破坏了gcloud cli,它要么是brew upgrade,要么是我安装的python,任何关于如何缩小这个范围的信息都将不胜感激。
因为我用google-cloud-sdk安装了brew,所以可以用brew uninstall google-cloud-sdk卸载它。
但是,我仍然无法删除gcloud二进制文件(?)我经常看到下面的堆栈跟踪
运行gcloud -h会产生以下错误(请在卸载google-cloud-sdk__后注意这一点)
ERROR: gcloud failed to load: module 'collections' has no attribute 'Mapping'
gcloud_main = _import_gcloud_main()
import googlecloudsdk.gcloud_main
from googlecloudsdk.calliope import cli
from googlecloudsdk.calliope import actions
from googlecloudsdk.calliope import markdown
from googlecloudsdk.calliope import usage_text
from googlecloudsdk.calliope import parser_arguments
from googlecloudsdk.calliope import parser_completer
from googlecloudsdk.core.console import progress_tracker
class _BaseStagedProgressTracker(collections.Mapping):
This usually indicates corruption in your gcloud installation or problems with your Python interpreter.
Please verify that the following is the path to a working Python 2.7 or 3.5+ executable:
/Library/Frameworks/Python.framework/Versions/3.10/bin/python3
If it is not, please set the CLOUDSDK_PYTHON environment variable to point to a working Python 2.7 or 3.5+ executable.
If you are still experiencing problems, please reinstall the Cloud SDK using the instructions here:
https://cloud.google.com/sdk//Library/Frameworks/Python.framework/Versions/3.10/bin/python3是一个有效的路径,运行它将为我提供以下输出
/Library/Frameworks/Python.framework/Versions/3.10/bin/python3 -V
Python 3.10.5我希望能够清理安装并使其恢复到工作状态,因为我使用cloud_sql_proxy组件能够定期连接到GCP中的数据库,用于开发目的。
如果需要进一步的信息,请告诉我。
任何帮助和洞察力都会很有帮助。
提前感谢
发布于 2022-09-01 09:50:27
我通过将它指向python2.7版本(默认安装)来修正它。
将这一行粘贴到终端中:
export CLOUDSDK_PYTHON=/usr/bin/python参考文献:https://stackoverflow.com/a/64270348/14332340
如果您在该路径上有python2.7,可以通过运行/usr/bin/python -V来反复检查。
我希望这能帮到你!
发布于 2022-09-02 23:33:29
回答我自己的问题。
我安装了Python3.9,解决了这个问题。
https://stackoverflow.com/questions/72709125
复制相似问题