卸载 Google Cloud CLI

对于使用操作系统软件包(例如 apt-getyum)完成的安装,请使用操作系统软件包管理器卸载 gcloud CLI。

对于 Windows 安装,请在 gcloud CLI 目录中执行 uninstaller.exe 文件。

如需移除 gcloud CLI,请按照以下说明操作:

  1. 运行以下命令查找您的安装目录:

     gcloud info --format='value(installation.sdk_root)'
    

    运行以下命令查找您的用户配置目录(在 MacOS 和 Linux 上通常为 ~/.config/gcloud):

     gcloud info --format='value(config.paths.global_config_dir)'
    
  2. 删除这两个目录。

  3. 此外,请移除 .bashrc 或等效 shell init 文件中对 completion.bash.incpath.bash.inc 执行 source 命令的命令行(如果您在安装期间添加了这些命令行)。

  4. 查看主目录中 .boto 文件的内容,并移除 [GoogleCompute][GSUtil] 部分。此外,请查看 [OAuth2][Credentials] 部分中不再需要的设置。

  5. 某些系统可能具有 Cache 目录,例如 Mac OS X 上的 ~/Library/Caches/。查找并删除系统的这些目录:

     find ~/Library/Caches/ -type d -name "google-cloud-sdk" | xargs rm -r