Bash 安装Google Cloud SDK:gcloud命令未找到

Bash 安装Google Cloud SDK:gcloud命令未找到,bash,google-cloud-platform,gcloud,Bash,Google Cloud Platform,Gcloud,我安装了谷歌云SDK。但是,我无法使用来自终端的命令 使用MacOS,我可以确认安装了Python 2: >python -V Python 2.7.15 然后下载存档文件macOS 64位并解压缩到主目录 $ ./google-cloud-sdk/install.sh Welcome to the Google Cloud SDK! To help improve the quality of this product, we collect anonymized usage dat

我安装了谷歌云SDK。但是,我无法使用来自终端的命令

使用MacOS,我可以确认安装了Python 2:

>python -V
Python 2.7.15
然后下载存档文件macOS 64位并解压缩到主目录

$ ./google-cloud-sdk/install.sh
Welcome to the Google Cloud SDK!

To help improve the quality of this product, we collect anonymized usage data
and anonymized stacktraces when crashes are encountered; additional information
is available at <https://cloud.google.com/sdk/usage-statistics>. You may choose
to opt out of this collection now (by choosing 'N' at the below prompt), or at
any time in the future by running the following command:

    gcloud config set disable_usage_reporting true

Do you want to help improve the Google Cloud SDK (Y/n)?  y


This will install all the core command line tools necessary for working with
the Google Cloud Platform.



Your current Cloud SDK version is: 224.0.0
Installing components from version: 270.0.0
.
.
.
The Google Cloud SDK installer will now prompt you to update an rc
file to bring the Google Cloud CLIs into your environment.

Enter a path to an rc file to update, or leave blank to use
[/Users/Akil/.bash_profile]:
Backing up [/Users/Akil/.bash_profile] to [/Users/Akil/.bash_profile.backup].
[/Users/Akil/.bash_profile] has been updated.

==> Start a new shell for the changes to take effect.


For more information on how to get started, please visit:
  https://cloud.google.com/sdk/docs/quickstarts

$ gcloud init
-bash: gcloud: command not found

我该如何解决这个问题?如果您有任何建议,我们将不胜感激。

啊,稍后当我导航到sdk安装目录时,这会起作用:

$cd google-cloud-sdk
ls
LICENSE         completion.zsh.inc  path.bash.inc
README          data            path.fish.inc
RELEASE_NOTES       deb         path.zsh.inc
VERSION         install.bat     platform
bin         install.sh      properties
completion.bash.inc lib         rpm
$ ls bin/
bootstrapping           gcloud
bq              git-credential-gcloud.sh
dev_appserver.py        gsutil
docker-credential-gcloud    java_dev_appserver.sh
endpointscfg.py
Shannons-MacBook-Air:google-cloud-sdk Akil$ bin
bin/           binhex         binhex5.18.pl  binstar
bind           binhex.pl      binhex5.28.pl
$ bin/gcloud init
Welcome! This command will take you through the configuration of gcloud.

Settings from your current configuration [default] are:
core:
.....

如果有人面临同样的问题,我会将此留在这里。

啊,稍后当我导航到sdk安装目录时,这会起作用:

$cd google-cloud-sdk
ls
LICENSE         completion.zsh.inc  path.bash.inc
README          data            path.fish.inc
RELEASE_NOTES       deb         path.zsh.inc
VERSION         install.bat     platform
bin         install.sh      properties
completion.bash.inc lib         rpm
$ ls bin/
bootstrapping           gcloud
bq              git-credential-gcloud.sh
dev_appserver.py        gsutil
docker-credential-gcloud    java_dev_appserver.sh
endpointscfg.py
Shannons-MacBook-Air:google-cloud-sdk Akil$ bin
bin/           binhex         binhex5.18.pl  binstar
bind           binhex.pl      binhex5.28.pl
$ bin/gcloud init
Welcome! This command will take you through the configuration of gcloud.

Settings from your current configuration [default] are:
core:
.....

我把这个放在这里,如果有人面临同样的问题。

似乎安装gcloud的地方都没有更新到您的$PATH中,这让我有点吃惊,因为它认为不需要更新您的
。bash\u profile
@robsiemb所以这是$PATH问题?如何添加它?由于在shell中运行命令时找不到gcloud,但在使用更完整的路径名运行命令时(如回答中所示)会找到gcloud,因此您的路径显然没有设置为包含此目录。可能也是相关的,但它更老。似乎安装gcloud的地方都没有更新到您的$PATH中,这让我有点吃惊,因为它认为不需要更新您的
。bash_profile
@robsiemb所以这是$PATH问题?如何添加它?由于在shell中运行命令时找不到gcloud,但在使用更完整的路径名运行命令时(如回答中所示)会找到gcloud,因此您的路径显然没有设置为包含此目录。可能也是相关的,但它更古老。