简体   繁体   English

在 Apple Silicon / Big Sur 上安装 Google Cloud SDK 时出现 anthoscli 错误

[英]anthoscli ERROR on installing Google Cloud SDK on Apple Silicon / Big Sur

I am searching for the solution for some weeks now.我正在寻找解决方案几个星期了。 A couple weeks ago I received the new MacBook Pro with the Apple Silicon processor and with Big Sur installed on it.几周前,我收到了配备 Apple Silicon 处理器并安装了 Big Sur 的新款 MacBook Pro。 When I tried to install Google Cloud SDK, because I need that for my work, I get my first problem.当我尝试安装 Google Cloud SDK 时,因为我的工作需要它,我遇到了第一个问题。 I opened the terminal and used "curl https://sdk.cloud.google.com | bash" to start the installation.我打开终端并使用“curl https://sdk.cloud.google.com | bash”开始安装。

After I received the question if I want to help to improve Google Cloud SDK and hit 'N' this error follows.在收到问题后,如果我想帮助改进 Google Cloud SDK 并点击“N”,就会出现此错误。 Also when I hit 'Y'...当我点击'Y'时......

ERROR: (gcloud.components.update) The following components are unknown [anthoscli].

On the inte.net I can't found something about this error.在 inte.net 上我找不到关于这个错误的信息。 The only thing what I have found on anthoscli is that I think it has something to do with Kube.netes and/or Docker. So I tried to install Docker first, only they are not ready for Apple Silicon yet...我在 anthoscli 上发现的唯一一件事是我认为它与 Kube.netes 和/或 Docker 有关。所以我首先尝试安装 Docker,只是它们还没有为 Apple Silicon 做好准备......

I can't imagine being the only one with this problem so I hope someone here can help me further.我无法想象自己是唯一一个遇到这个问题的人,所以我希望这里有人能进一步帮助我。

It's a known issue " Apple Silicon Installer does not exist "这是一个已知问题“ Apple Silicon Installer 不存在

The workaround from the above link is:上述链接的解决方法是:

  1. Attempt install: curl https://sdk.cloud.google.com | bash尝试安装: curl https://sdk.cloud.google.com | bash curl https://sdk.cloud.google.com | bash
  2. Run installer manually using files from above failed install ./google-cloud-sdk/bin/gcloud components install core gsutil使用上述文件手动运行安装程序失败 install ./google-cloud-sdk/bin/gcloud components install core gsutil
  3. Re-run init: ./google-cloud-sdk/bin/gcloud init重新运行初始化:./google-cloud-sdk/bin/ ./google-cloud-sdk/bin/gcloud init

I got gcloud to install by installing under Rosetta 2.我通过在 Rosetta 2 下安装来安装 gcloud。

curl https://sdk.cloud.google.com > install.sh
chmod +x install.sh
arch -x86_64 install.sh --disable-prompts
# restart shell
gcloud help

I don't think Apple did a good job of advertising this feature, because I only found it in a random Hacker News thread.我不认为 Apple 在宣传这个功能方面做得很好,因为我只是在随机的 Hacker News 线程中发现它。 I've used this strategy quite a bit and added this to my shell's rc file.我已经多次使用这种策略并将其添加到我的 shell 的 rc 文件中。

x86() {
    arch -x86_64 $1
}
x86 install.sh --disable-prompts

I just tested on Apple M1 MBP Big Sur 11.1, which works for me.我刚刚在适用于我的 Apple M1 MBP Big Sur 11.1 上进行了测试。

Followed mager.co blogpost-How to install gcloud on an M1 Mac关注 mager.co 博文-如何在 M1 Mac 上安装 gcloud

Full steps as following:完整步骤如下:

  1. Install homebrew package management first先安装homebrew package管理

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

  2. Install Python 3.9.1 use pyenv安装 Python 3.9.1 使用pyenv

     brew install pyenv pyenv install 3.9.1 pyenv global 3.9.1
  3. Set an env variable letting the gcloud installer know which version of Python to use:设置一个环境变量,让 gcloud 安装程序知道要使用哪个版本的 Python:

    export CLOUDSDK_PYTHON=python3

  4. Download the SDK and start the install, which I ran into ERROR the following components are unknown [anthoscli, kuberun] :下载 SDK 并开始安装,我遇到了 ERROR以下组件未知 [anthoscli, kuberun]

    curl https://sdk.cloud.google.com | bash

  5. Thus manually run the install.sh script因此手动运行install.sh脚本

    cd ~/google-cloud-sdk./install.sh --override-components core gcloud-deps bq gcloud gsutil

The easiest way to install Google Cloud SDK is with homebrew, but Homebrew doesn't have an arm64 variant for M1 yet.安装 Google Cloud SDK 的最简单方法是使用自制软件,但自制软件还没有用于 M1 的arm64变体。 Nonetheless, I've outlined steps to install and use it on M1 Macs: https://stackoverflow.com/a/66299285/2006016尽管如此,我已经概述了在 M1 Mac 上安装和使用它的步骤: https://stackoverflow.com/a/66299285/2006016

1. Installing gcloud SDK 1.安装gcloud SDK

After installing your Homebrew on your M1 Mac, in your Rosetta Terminal, run the following command:在 M1 Mac 上安装 Homebrew后,在 Rosetta 终端中运行以下命令:

brew install --cask google-cloud-sdk

2. Linking gcloud to $PATH 2. 将gcloud链接到 $PATH

Once Homebrew has it installed, you'll need to add it to your path.安装 Homebrew 后,您需要将其添加到您的路径中。 In the last few lines it will show you the path to set your source:在最后几行中,它将向您展示设置源的路径:

源-gcloud-homebrew-m1

From the screenshot above, I'll have to run the following to set the command in my $PATH:从上面的屏幕截图中,我必须运行以下命令在我的 $PATH 中设置命令:

source /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc
source /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc

3. Using gcloud 3. 使用gcloud

Once linked, you can use the gcloud command in your terminal:链接后,您可以在终端中使用gcloud命令:

gcloud -v

4. Outdated Python 4.过时的Python

In case your python is outdated (see Google Cloud SDK Requirements ), you can use Homebrew to update it by running:如果您的 python 已过时(请参阅Google Cloud SDK 要求),您可以使用 Homebrew 通过运行来更新它:

brew upgrade

You can view your python version when listing out your Homebrew packages:列出 Homebrew 软件包时,您可以查看 python 版本:

brew outdated

This happens when you have MAC M1 chip so you might need to install manually for this i choose to go with Google given method当您拥有 MAC M1 芯片时会发生这种情况,因此您可能需要为此手动安装我选择 go 使用 Google 给定的方法

muhasan@Admins-MacBook-Pro ~ % curl https://sdk.cloud.google.com | bash

Output: Output:

For the latest full release notes, please visit:
  https://cloud.google.com/sdk/release_notes

╔════════════════════════════════════════════════════════════╗
╠═ Creating update staging area                             ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: BigQuery Command Line Tool                   ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: BigQuery Command Line Tool (Platform Spec... ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Cloud Storage Command Line Tool              ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Cloud Storage Command Line Tool (Platform... ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Default set of gcloud commands               ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Google Cloud CLI Core Libraries (Platform... ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: anthoscli                                    ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: anthoscli                                    ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: gcloud cli dependencies                      ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Creating backup and activating new installation          ═╣
╚════════════════════════════════════════════════════════════╝

Performing post processing steps...done.                                                                                                                                                                                                     

Update done!

Please follow the steps mentioned in the following Google Cloud SDK Installation Documentation to install Google Cloud SDK on MacOS:请按照以下Google Cloud SDK 安装文档中提到的步骤在 MacOS 上安装 Google Cloud SDK:

  1. Cloud SDK requires Python.云 SDK 需要 Python。 Follow the next documentation on how to choose and configure your Python interpreter按照下一个文档了解如何选择和配置 Python 解释器

  2. Download the MacOS package from the Google Cloud SDK Documentation .Google Cloud SDK 文档下载 MacOS package。

2.1) Extract the archive to any location on your file system. 2.1) 将存档解压缩到文件系统上的任何位置。 On macOS, this can be achieved by opening the downloaded .tar.gz archive file in the preferred location.在 macOS 上,这可以通过在首选位置打开下载的.tar.gz存档文件来实现。

2.2) Optional. 2.2) 可选。 Use the install script to add Cloud SDK tools to your path -->使用安装脚本将 Cloud SDK 工具添加到您的路径 -->

 ./google-cloud-sdk/install.sh

2.3) Close and Open a new terminal so that the changes take effect. 2.3)关闭并打开一个新终端,使更改生效。

2.4) Run gcloud init to initialize the SDK: 2.4)运行gcloud init初始化SDK:

./google-cloud-sdk/bin/gcloud init

As I can see that you have use the Google Cloud SDK Installer to install Google Cloud SDK on MacOS.如我所见,您已使用Google Cloud SDK 安装程序在 MacOS 上安装 Google Cloud SDK。 Please try again the following steps to install Google Cloud SDK using the installer:请重试以下步骤,使用安装程序安装 Google Cloud SDK:

  1. Enter the following at a command prompt:在命令提示符处输入以下内容:
   curl https://sdk.cloud.google.com | bash
  1. Restart your shell:重新启动您的 shell:
exec -l $SHELL
  1. Run gcloud init to initialize the gcloud environment:运行 gcloud init 初始化 gcloud 环境:
gcloud init

In case you want to install Google Cloud SDK through the interactive installer, and you are getting the error mentioned above, You can create an issue on Google's Public Issue Tracker for further investigation.如果您想通过交互式安装程序安装 Google Cloud SDK,并且遇到上述错误,您可以在 Google 的公共问题跟踪器上创建问题以进行进一步调查。 However also please try to install the Google Cloud SDK without the installer as I mentioned before.但是,也请尝试在没有我之前提到的安装程序的情况下安装Google Cloud SDK

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM