Google Cloud SDK引发可达性检查失败错误 [英] Google Cloud SDK throws Reachability Check failed error

查看:288
本文介绍了Google Cloud SDK引发可达性检查失败错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 gcloud init 命令在 mac os 上对我的帐户进行身份验证,这会引发与 SSL证书相关的错误.我正在使用 python 3.7 和最新版本的google clound sdk.

I am trying to use gcloud init command to authenticate my account on mac os and it throws me error related to SSL Certificate. I am using python 3.7 and latest version of google clound sdk.

> gcloud info --run-diagnostics

Network diagnostic detects and fixes local network connection issues.
Checking network connection...done.
ERROR: Reachability Check failed.
    Cannot reach https://cloudresourcemanager.googleapis.com/v1beta1/projects with httplib2 (SSLCertVerificationError)
    Cannot reach https://www.googleapis.com/auth/cloud-platform with httplib2 (SSLCertVerificationError)
    Cannot reach https://cloudresourcemanager.googleapis.com/v1beta1/projects with requests (SSLError)
    Cannot reach https://www.googleapis.com/auth/cloud-platform with requests (SSLError)
Network connection problems may be due to proxy or firewall settings.

我没有任何公司代理人.

I am not behind any corporate proxy.

更新:用于 gcloud info --run-diagnostics --verbosity debug

DEBUG: Running [gcloud.info] with arguments: [--run-diagnostics: "True", --verbosity: "debug"]
Network diagnostic detects and fixes local network connection issues.
Checking network connection...⠶DEBUG: Starting new HTTPS connection (1): accounts.google.com:443
Checking network connection...⠧DEBUG: https://accounts.google.com:443 "GET / HTTP/1.1" 302 338
Checking network connection...⠏DEBUG: https://accounts.google.com:443 "GET /ServiceLogin?passive=1209600&continue=https%3A%2F%2Faccounts.google.com%2F&followup=https%3A%2F%2Faccounts.google.com%2F HTTP/1.1" 200 None
Checking network connection...⠛DEBUG: Starting new HTTPS connection (1): cloudresourcemanager.googleapis.com:443
DEBUG: Starting new HTTPS connection (1): www.googleapis.com:443
Checking network connection...⠹DEBUG: Starting new HTTPS connection (1): dl.google.com:443
Checking network connection...⠼DEBUG: https://dl.google.com:443 "GET /dl/cloudsdk/channels/rapid/components-2.json HTTP/1.1" 200 144486
Checking network connection...done.
ERROR: Reachability Check failed.
    Cannot reach https://cloudresourcemanager.googleapis.com/v1beta1/projects with httplib2 (SSLCertVerificationError)
    Cannot reach https://www.googleapis.com/auth/cloud-platform with httplib2 (SSLCertVerificationError)
    Cannot reach https://cloudresourcemanager.googleapis.com/v1beta1/projects with requests (SSLError)
    Cannot reach https://www.googleapis.com/auth/cloud-platform with requests (SSLError)
Network connection problems may be due to proxy or firewall settings.

@JohnHanley要求的 gcloud信息的输出

Output for gcloud info as requested by @JohnHanley

Python Location: [/Library/Frameworks/Python.framework/Versions/3.7/bin/python3]
Site Packages: [Disabled]

Installation Root: [/home/myname/google-cloud-sdk]
Installed Components:
  gsutil: [4.55]
  core: [2020.12.04]
  bq: [2.0.64]
System PATH: [/home/myname/google-cloud-sdk/bin:/usr/local/opt/openssl@1.1/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/home/myname/Desktop/Projects/google-cloud-sdk/bin:/usr/local/opt/openssl@1.1/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/home/myname/opt/anaconda3/bin:/home/myname/opt/anaconda3/condabin:/home/myname/Library/Python/3.7/bin:/home/myname/Library/Python/3.7/bin]
Python PATH: [/home/myname/google-cloud-sdk/lib/third_party:/home/myname/google-cloud-sdk/lib:/Library/Frameworks/Python.framework/Versions/3.7/lib/python37.zip:/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7:/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload]
Cloud SDK on PATH: [True]
Kubectl on PATH: [/usr/local/bin/kubectl]

WARNING: There are other instances of the Google Cloud Platform tools on your system PATH.
  /home/myname/Desktop/Projects/google-cloud-sdk/bin/dev_appserver.py
  /home/myname/Desktop/Projects/google-cloud-sdk/bin/docker-credential-gcloud
  /home/myname/Desktop/Projects/google-cloud-sdk/bin/endpointscfg.py
  /home/myname/Desktop/Projects/google-cloud-sdk/bin/gcloud
  /home/myname/Desktop/Projects/google-cloud-sdk/bin/git-credential-gcloud.sh
  /home/myname/Desktop/Projects/google-cloud-sdk/bin/java_dev_appserver.sh
  /home/myname/Desktop/Projects/google-cloud-sdk/bin/anthoscli
  /home/myname/Desktop/Projects/google-cloud-sdk/bin/gsutil
  /home/myname/Desktop/Projects/google-cloud-sdk/bin/bq

Installation Properties: [/home/myname/google-cloud-sdk/properties]
User Config Directory: [/home/myname/.config/gcloud]
Active Configuration Name: [abc]
Active Configuration Path: [/home/myname/.config/gcloud/configurations/config_abc]

Account: [None]
Project: [None]

Current Properties:
  [core]
    disable_usage_reporting: [False]

Logs Directory: [/home/myname/.config/gcloud/logs]
Last Log File: [/home/myname/.config/gcloud/logs/2020.12.08/20.07.56.822405.log]

git: [git version 2.24.3 (Apple Git-128)]
ssh: [OpenSSH_8.1p1, LibreSSL 2.7.3]

推荐答案

您的系统混乱了.

  • 查看 Python位置.与 Python PATH PATH 比较.
  • 您的PATH中安装了多个Python和CLI.
  • 您的PATH混合了3.7和3.8,这是灾难的根源.
  • 您有一部分相对于台式机安装.

我的建议:

  • 删除所有CLI安装.
  • 删除旧的Python安装-考虑到所有Python库现在都搞砸了,请考虑删除所有版本并重新安装(在执行以下步骤并重新启动之后).
  • 删除所有Google CLI安装(gcloud).
  • 清理路径并删除已删除的目录.
  • 确保没有遗留残余物.
  • 重新启动.
  • 重新安装Google CLI.

提示.对于Python或CLI,请不要相对于您的主目录进行安装.

Tip. Do not install relative to you home directory for Python or the CLI.

在macOS上删除Python安装.

Removing Python installations on macOS.

这是一个摘要.确切步骤取决于您的设置.本质上,您要从PATH变量,环境和PYTHON变量中删除Python和CLI.还要从磁盘上删除它们,以便您可以完成全新安装.

This is a summary. The exact steps depend on your setup. In essence you want to remove Python and the CLI from the PATH variable, the environment and the PYTHON varaibles. Also delete them from disk so that you can complete fresh installations.

  • 该操作系统具有其自己的安装.该文件位于/Library/Frameworks/Python.framework 中.您有多个安装重复了多次.阅读本文以删除这些安装: https://www.macupdate.com/app/mac/5880/python/uninstall
  • 我建议修改PATH以删除3.7和3.8版本,并修改环境以删除那些引用.
  • 从PATH中删除/Library/Frameworks/Python.framework/Versions/3.7/lib/python37.zip .
  • 删除目录/home/myname/Library/Python/3.7/bin 和内容.
  • 删除目录/home/myname/Library/Python/3.8/bin 和内容.
  • 阅读此链接以删除Google SDK https://cloud.google.com/sdk/docs/uninstall-cloud-sdk
  • 删除与PYTHON相关的环境变量,例如PYTHONPATH.
  • 从PATH中删除以/home/myname/google-cloud-sdk 开头的所有内容.还要删除目录和内容.
  • The OS comes with its own installation. That is located in /Library/Frameworks/Python.framework. You have more than one installation repeated more than once. Read this article to remove those installations: https://www.macupdate.com/app/mac/5880/python/uninstall
  • I recommend modifying the PATH to remove the 3.7 and 3.8 versions and modify your environment to remove those references.
  • Remove /Library/Frameworks/Python.framework/Versions/3.7/lib/python37.zip from the PATH.
  • Delete the directory /home/myname/Library/Python/3.7/bin and contents.
  • Delete the directory /home/myname/Library/Python/3.8/bin and contents.
  • Read this link for removing the Google SDK https://cloud.google.com/sdk/docs/uninstall-cloud-sdk
  • Delete the environment variables related to PYTHON such as PYTHONPATH.
  • Delete anything starting with /home/myname/google-cloud-sdk from the PATH. Also delete the directory and contents.

注意:您还安装了Anaconda.我建议删除它,因为它也有自己的Python版本.

Note: You also have Anaconda installed. I recommend removing that as it also has its own Python version.

这篇关于Google Cloud SDK引发可达性检查失败错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆