[英]Unable to uninstall / install / use the gcloud cli
我一直很高兴在运行 macOS Monterey 版本 12.4 的 macbook 上使用 gcloud cli
我做了一个似乎已经破坏 gcloud cli 的 brew brew upgrade
,它要么是brew upgrade
,要么是我所做的 python 安装,有关如何缩小范围的任何信息将不胜感激。
因为我用brew
安装了google-cloud-sdk
我可以用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
是一个有效路径,运行它会给我以下 output
/Library/Frameworks/Python.framework/Versions/3.10/bin/python3 -V
Python 3.10.5
我希望能够清理安装并将其恢复为正常工作的 state,因为我使用cloud_sql_proxy
组件能够定期连接到 GCP 中的数据库以用于开发目的。
如果需要更多信息,请告诉我。
任何帮助和见解都会非常有帮助。
提前致谢
我通过将其指向 python 2.7 版本(默认安装)来修复它。
将此行粘贴到您的终端中:
export CLOUDSDK_PYTHON=/usr/bin/python
参考: https://stackoverflow.com/a/64270348/14332340
通过运行/usr/bin/python -V
仔细检查您是否在该路径上有 python 2.7 可能会很好。
我希望这有帮助!
回答我自己的问题。
我安装了 Python 3.9 并解决了这个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.