当前位置: 首页 > 知识库问答 >
问题:

安装Google Cloud SDK:找不到gCloud命令

卢英范
2023-03-14

我安装了谷歌云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

还尝试了以下方法:

$curl https://sdk.cloud.google.com | bash
exec -l $SHELL

curl https://sdk.cloud.google.com | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   443  100   443    0     0   3233      0 --:--:-- --:--:-- --:--:--  3233
Downloading Google Cloud SDK install script: https://dl.google.com/dl/cloudsdk/channels/rapid/install_google_cloud_sdk.bash
######################################################################## 100.0%
Running install script from: /var/folders/6z/2gkzhgc11mg_1_yks2_5ykw00000gn/T/tmp.XXXXXXXXXX.ZM2XG3E6/install_google_cloud_sdk.bash
which curl
curl -# -f https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.tar.gz
########################################################################################################################################################################### 100.0%


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 SDK Core Libraries (Platform Specific) ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Cloud Storage Command Line Tool              ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Cloud Storage Command Line Tool (Platform... ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Default set of gcloud commands               ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: gcloud cli dependencies                      ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Creating backup and activating new installation          ═╣
╚════════════════════════════════════════════════════════════╝

Performing post processing steps...done.

Update done!


Modify profile to update your $PATH and enable shell command
completion?

Do you want to continue (Y/n)?
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]:  No changes necessary for [/Users/Akil/.bash_profile].

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

$ gcloud init
-bash: gcloud: command not found

我如何解决这个问题?任何建议都将不胜感激。

共有1个答案

宓英哲
2023-03-14

啊,稍后当我导航到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:
.....

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

 类似资料:
  • 我在mac上,正在尝试在terminal中使用此命令安装Google Cloud SDK(包括gcloud命令行实用程序 它一直运行到最后并完成了,但即使在我重新启动shell之后,命令仍然说没有找到它。 为什么这个安装不起作用?

  • 问题内容: 执行时似乎得到以下提示 不幸的是,执行任何Bower命令都会返回 返回和运行返回。 问题答案: 我假设您是通过Homebrew安装Node.js的,它烦人地将已安装的npm二进制文件放在通常不在用户路径中的位置。您要做的就是添加到$ PATH中。您可以通过将其添加到.bashrc / .bash_profile / .zshrc文件中来实现。 尽管我宁愿卸载Homebrew安装的Nod

  • 问题内容: 因此,我安装了 Anaconda ,一切正常。安装后,我决定切换到。我现在得到: 尝试使用或安装时 5.0.5 我已添加到我的 我想念的是什么? 问题答案: 看来我的PATH在我的文件中已损坏。 打开并添加: h!好吧,这将解释一切。我怎么想念那个小分号?已更改: 我们现在很好。

  • 在目录下查看时,可以看到可执行文件。 我的npm安装有问题吗?

  • 问题内容: 我很难使npm命令正常工作,但是不幸的是,我对Unix的了解不足以独自解决这个问题。我所做的只是,并且出现以下错误: 当我型我得到 进一步研究此问题,我发现此堆栈溢出答案: 在zsh中安装npm后找不到命令 按照其建议,我尝试将其添加到我的.zshrc文件中。键入时仍然出现相同的错误 我可以确认这是在收益率中 我还可以确认节点已安装率 有任何想法吗?我很困惑 问题答案: 不是答案,而是