找不到gcloud命令-安装Google Cloud SDK

找不到gcloud命令-安装Google Cloud SDK

问题描述:

我正在尝试在终端中使用以下命令在Mac上安装Google Cloud SDK

I am trying to install the Google Cloud SDK on Mac using the following command in terminal

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

工作正常,但是当我转到

It worked fine but when I move to the next step of

gcloud init

我得到以下

-bash:gcloud:找不到命令

-bash: gcloud: command not found

我已经尝试了与中的相同问题的所有解决方案在这里,但是我仍然收到相同的错误消息.安装程序也没有通过以下消息提示我:修改配置文件以更新$ PATH并启用bash完成?(是/否)?

I have tried all solutions to the same question as in here, however I still get the same error message. The installer didn't prompt me with the following message either: Modify profile to update your $PATH and enable bash completion? (Y/n)?

此问题的根本原因是未将Cloud SDK添加到您的路径中.如果您遵循了有关此问题的许多其他答案,但仍然有相同的答案问题,这意味着您错过了一步.

The root cause of this is the Cloud SDK not being added to your path. If you followed the multitude of other answers about this issue and still have the same problem, it means you missed a step.

您可以编辑/Users/<您的姓名>/.profile ,并且可以包含以下几行:

You can edit /Users/<yourname>/.profile and either include the following lines:

# The next line updates PATH for the Google Cloud SDK.
source '<path-to-where-you-installed-the-cloud-sdk>/path.bash.inc'

或者您可以手动设置PATH变量:

Or you can manually set your PATH variable:

export $PATH=<path-to-where-you-installed-the-cloud-sdk>:$PATH