我正在按照Quickstart for Mac OS X来安装cloud SDK。完全按照步骤进行,
1) python -V
返回"Python 2.7.10“
2)使用./install.sh
下载并解压google-cloud-sdk return中的64位版本的SDK。
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
Your current Cloud SDK version is: 170.0.1
The latest available version is: 170.0.1
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Components │
├───────────────┬──────────────────────────────────────────────────────┬──────────────────────────┬───────────┤
│ Status │ Name │ ID │ Size │
├───────────────┼──────────────────────────────────────────────────────┼──────────────────────────┼───────────┤
│ Not Installed │ App Engine Go Extensions │ app-engine-go │ 97.7 MiB │
│ Not Installed │ Cloud Bigtable Command Line Tool │ cbt │ 4.0 MiB │
│ Not Installed │ Cloud Bigtable Emulator │ bigtable │ 3.5 MiB │
│ Not Installed │ Cloud Datalab Command Line Tool │ datalab │ < 1 MiB │
│ Not Installed │ Cloud Datastore Emulator │ cloud-datastore-emulator │ 15.4 MiB │
│ Not Installed │ Cloud Datastore Emulator (Legacy) │ gcd-emulator │ 38.1 MiB │
│ Not Installed │ Cloud Pub/Sub Emulator │ pubsub-emulator │ 33.2 MiB │
│ Not Installed │ Emulator Reverse Proxy │ emulator-reverse-proxy │ 14.5 MiB │
│ Not Installed │ Google Container Local Builder │ container-builder-local │ 3.7 MiB │
│ Not Installed │ Google Container Registry's Docker credential helper │ docker-credential-gcr │ 2.2 MiB │
│ Not Installed │ gcloud Alpha Commands │ alpha │ < 1 MiB │
│ Not Installed │ gcloud Beta Commands │ beta │ < 1 MiB │
│ Not Installed │ gcloud app Java Extensions │ app-engine-java │ 128.1 MiB │
│ Not Installed │ gcloud app PHP Extensions (Mac OS X) │ app-engine-php-darwin │ 21.9 MiB │
│ Not Installed │ gcloud app Python Extensions │ app-engine-python │ 6.5 MiB │
│ Not Installed │ kubectl │ kubectl │ 15.9 MiB │
│ Installed │ BigQuery Command Line Tool │ bq │ < 1 MiB │
│ Installed │ Cloud SDK Core Libraries │ core │ 6.7 MiB │
│ Installed │ Cloud Storage Command Line Tool │ gsutil │ 3.0 MiB │
└───────────────┴──────────────────────────────────────────────────────┴──────────────────────────┴───────────┘
To install or remove components at your current SDK version [170.0.1], run:
$ gcloud components install COMPONENT_ID
$ gcloud components remove COMPONENT_ID
To update your SDK installation to the latest version [170.0.1], run:
$ gcloud components update
==> Source [/Users/shaneoseasnain/Desktop/google-cloud-sdk/completion.bash.inc] in your profile to enable shell command completion for gcloud.
==> Source [/Users/shaneoseasnain/Desktop/google-cloud-sdk/path.bash.inc] in your profile to add the Google Cloud SDK command line tools to your $PATH.
For more information on how to get started, please visit:
https://cloud.google.com/sdk/docs/quickstarts
3)重启终端,在google-cloud-sdk内部运行gcloud init
。这将返回“command not found
”。如果运行ls
,我会看到以下目录结构:
LICENSE completion.zsh.inc path.fish.inc
README deb path.zsh.inc
RELEASE_NOTES install.bat platform
VERSION install.sh properties
bin lib rpm
completion.bash.inc path.bash.inc
4)我也尝试过在bin
中运行gcloud init
,但是遇到了同样的问题,command not found
。
我在安装指南中看到的其他建议是“在bash shell中启用命令补全,和/或启用使用报告”。我不确定如何做到这一点,但命令完成和报告看起来不应该与这个问题相关。有很多关于command not found
的文章,但它们与其他问题有关,例如,gcloud在一段时间后停止工作,或者旧版本中的问题。有没有人能告诉我如何让云sdk正常工作?
谢谢
发布于 2017-11-21 18:26:19
我也有同样的问题。一个懒惰而快速的解决方法是直接运行:
brew install --cask google-cloud-sdk
通过谷歌搜索找到的。
发布于 2021-03-25 07:51:51
对于MAC OS -使用Homebrew
brew install --cask google-cloud-sdk
然后使用
source "$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc"
source "$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc"
发布于 2017-09-11 06:11:26
gcloud
可执行文件位于运行gcloud的google-cloud-sdk/bin
-to中。您需要执行以下任一操作:
.bash_profile
文件(more detail on what this file does and how to pick one)中添加source /Users/shaneoseasnain/Desktop/google-cloud-sdk/path.bash.inc
行就可以了。gcloud
可执行文件时指定它的完整路径。在您的示例中,这是/Users/shaneoseasnain/Desktop/google-cloud-sdk/bin/gcloud
。举个例子:$ /Users/shaneoseasnain/Desktop/google-cloud-sdk/bin/gcloud初始化
quickstart的相关部分(增加了重点):
运行安装脚本,将云开发工具包工具添加到路径中,在bash shell中启用命令补全,和/或启用使用情况报告:
至于为什么安装脚本不起作用,我不能说。请file an issue,我们会调查的。
https://stackoverflow.com/questions/46144267
复制相似问题