2

尝试在 Windows 10 上为所有用户安装 Google Cloud SDK(Python)。收到以下错误。

这是新机器,开始重新构建。在此之前安装了 python 2.7 版本。

请帮我解决这个问题。

输出文件夹:C:\Program Files (x86)\Google\Cloud SDK 正在下载 Google Cloud SDK 核心。提取 Google Cloud SDK 核心。创建 Google Cloud SDK bat 文件:C:\Program Files (x86)\Google\Cloud SDK\cloud_env.bat 安装组件。欢迎使用 Google Cloud SDK!这将安装使用 Google Cloud Platform 所需的所有核心命令行工具。回溯(最后一次调用):文件“C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin\bootstrapping\install.py”,第 214 行,在 main() 文件“C: \Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin\bootstrapping\install.py",第 192 行,在主安装(pargs.override_components,pargs.additional_components)文件“C:\Program Files ( x86)\Google\Cloud SDK\google-cloud-sdk\bin\bootstrapping\install.py",kwargs),无文件“C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\url_opener.py”,第 73 行,在 urlopen 返回 opener.open(req, data ,超时)文件“c:\users\cpa8161\appdata\local\temp\tmpxcdivh\python\lib\urllib2.py”,第 429 行,打开响应 = self._open(req, data) 文件“c:\users \cpa8161\appdata\local\temp\tmpxcdivh\python\lib\urllib2.py",第 447 行,在 _open '_open',req) 文件 "c:\users\cpa8161\appdata\local\temp\tmpxcdivh\python\ lib\urllib2.py”,第 407 行,在 _call_chain 结果 = func(*args) 文件“C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\url_opener.py ",第 58 行,在 https_open 返回 self.do_open(build, req) 文件 "c:\users\cpa8161\appdata\local\temp\tmpxcdivh\python\lib\urllib2.py",第 1195 行,在 do_open h.request(req.get_method(), req.get_selector(), req.data, headers) 文件中“c:\users\cpa8161\appdata\local\temp\tmpxcdivh\python\lib\httplib.py”,第 1042 行,在请求 self._send_request(方法、url、正文、标题)文件“c:\users\cpa8161 \appdata\local\temp\tmpxcdivh\python\lib\httplib.py”,第 1082 行,在 _send_request self.endheaders(body) 文件“c:\users\cpa8161\appdata\local\temp\tmpxcdivh\python\lib\ httplib.py”,第 1038 行,在 endheaders self._send_output(message_body) 文件“c:\users\cpa8161\appdata\local\temp\tmpxcdivh\python\lib\httplib.py”,第 882 行,在 _send_output self.send (味精)文件“c:\users\cpa8161\appdata\local\temp\tmpxcdivh\python\lib\httplib.py”,第 844 行,在发送 self.connect() 文件“C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\third_party\httplib2__init__.py”中,第 1081 行,在连接中引发 SSLHandshakeError(e ) **httplib2.SSLHandshakeError: [SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败 (_ssl.c:661)安装失败。

4

6 回答 6

6

您是否正在执行命令“ gcloud init ”?如果您在安装时遇到此问题,那就不同了。我直接下载了gcloud存档并将其解压缩,而不是使用在我的代理后面需要额外权限的安装程序。

我支持公司代理。执行该命令时出现以下错误

Rechecking network connection...done.
ERROR: Reachability Check still does not pass.
Cannot reach https://www.google.com (SSLHandshakeError)
Cannot reach https://accounts.google.com (SSLHandshakeError)

我遵循了这个程序。这也可能对您有所帮助。

  1. 导出您组织的受信任根证书。

在此处输入图像描述

  1. 使用记事本打开此证书。
  2. 将内容附加到

     \Google\Cloud SDK\google-cloud-sdk-201.0.0-windows-x86_64\google-cloud-sdk\lib\third_party\httplib2\python2\httplib2
    

    请注意我的 Gcloud 使用的 Python 版本的路径是 2.x

于 2018-05-25T07:53:08.053 回答
2

我只是花了几个小时试图让安装程序运行并尝试编辑 ca cert 文件,但安装程序会在安装过程中不断擦除目录。为了使捆绑 gcloud sdk 安装程序工作,我最终不得不创建一个环境变量SSL_CERT_FILE并将路径设置为包含 Google CA + 我公司代理 CA 证书的 ca cert 文本文件。然后安装程序运行没有问题。python http客户端似乎使用env变量进行CA验证。

然后你需要在运行gcloud init之前运行gcloud config set custom_ca_certs_file

于 2019-05-29T19:16:36.547 回答
2

此错误已在 Google 的问题跟踪器上报告。

此问题是由公司代理背后引起的。目前,此处详细介绍的建议解决方法是将公司证书附加到 google-cloud-sdk/lib/third_party/httplib2/cacerts.txt

于 2017-09-21T14:54:05.383 回答
1

需要在..\google-cloud-sdk\lib\third_party\httplib2\cacerts.txt文件中添加以下证书。然后install.bat再次运行

----BEGIN CERTIFICATE-----
MIIDJjCCAg6gAwIBAgIIYkBXvgY381UwDQYJKoZIhvcNAQEFBQAwNjE0MDIGA1UE
AxMrZmVkZXJhdGVkLXNpZ25vbi5zeXN0ZW0uZ3NlcnZpY2VhY2NvdW50LmNvbTAe
Fw0xNzEwMTkxMTQzMzRaFw0xNzEwMjIxMjEzMzRaMDYxNDAyBgNVBAMTK2ZlZGVy
YXRlZC1zaWdub24uc3lzdGVtLmdzZXJ2aWNlYWNjb3VudC5jb20wggEiMA0GCSqG
SIb3DQEBAQUAA4IBDwAwggEKAoIBAQC1XYAow1e/aghfiZY7H2DFJIQ61okNrUfo
3tdNPtxT1Rr2QyA0Zv/lZ3/Z/Daux/Sb1gvLXBuvLkzVYpu8EHmiMvATK7MD+ZXv
ZTeREh2UB4grlcLq4mc9uTkiARNAhBrEBrYwMeFPQlfc7zB5kiRAZHMhijah/CRg
w8eVPn09xIJhfsytkFeHoVIz7EV1pD4VNqGZD+P80GEAgVfjh++leqOvCso4CP1G
YtaOpzPfI03XcH1y0+b+sLTXduOitEyEji5h7aHe2nxbY8JRodsZ8kK1i1W8LpFN
H+wZwHh/De5Zwoz3HE5EXDgYyaxT26ehqHbPaW4lkKgGDpx6oco5AgMBAAGjODA2
MAwGA1UdEwEB/wQCMAAwDgYDVR0PAQH/BAQDAgeAMBYGA1UdJQEB/wQMMAoGCCsG
AQUFBwMCMA0GCSqGSIb3DQEBBQUAA4IBAQANVlLefEJ9qYboQKBq5ADjftFGWTl8
hshV+dExMSj+dnXwScdvQcfUrqpxYZWtRP7290FjGHq54AtrPeQrYxffWXkb6OaQ
el9ZX4IEViJbmCrc52ePxMRnEInrWCV8zZVoej5W63dxGf2x4b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297ANfncXclhPjm3Cw9+5AGsPX
5OCF/RKPIJDainsOSMwhiY8fNIEaENMp82N7/16woWoD87UDOxbm2Z5Rfe3sQatv
L002NXs1y19U7QuhC25cxcgUC0ESxdXnmBHoLJo8ou73GNj4UJEppNWzXxaXCXtC
cLZWPMsSBG0M9WY9/UQ2P3273SajkSKMNrAwZFzUXvuwDreKHS89Qc44/JaFCCCS
we+lXMhRfWNeBCgS+xZGKe8dUjHrGD9c3RrKbDRDZ3XuQXZgd5VfL/GgjJTcDAXA
w1zzXQWX4Y6DcU+YXuCVVdOFtBC5qrhzLsiJxhFu+LTyJxLGihQuMytu
-----END CERTIFICATE-----
于 2017-10-20T18:03:49.120 回答
0

每次安装程序擦除目录时,您都无法通过 UI 安装。

因此,在更新文件上的组织 RootCA 后运行安装程序批处理文件:

C:\Users\<username>\AppData\Local\Google\Cloud SDK\google-cloud-sdk\lib\third_party\certifi\ cacert.pem
于 2020-01-24T23:55:03.107 回答
0

我发现除了上面的环境变量,你还需要通过创建配置文件来预配置gcloud sdk。我写了一个PS脚本来做到这一点。我已经成功地在几台计算机上使用了它。

# path to roots bundle
$rootsBundle = "full path to roots bundle"

# check if $env:appdata\gcloud\configurations exist. This indicates the gcloud is already initialized
# if not, create it
if (!(Test-Path "$env:APPDATA\gcloud\configurations\config_default")){

    # create configurations directory
    New-Item "$env:APPDATA\gcloud\configurations" -ItemType "directory" -Force

    # write ssl config to core config
    "[core]`r`ncustom_ca_certs_file = $rootsBundle" | Out-File -FilePath "$env:APPDATA\gcloud\configurations\config_default" -Encoding ASCII -NoNewline

    # set config to default config
    "default" | Out-File -FilePath "$env:APPDATA\gcloud\active_config" -Encoding ASCII -NoNewline
}
else {
    Write-Host "GCloud config already detected. We will assume you already configured the CA bundle"
}

# download and start gcloud sdk installer
(New-Object Net.WebClient).DownloadFile("https://dl.google.com/dl/cloudsdk/channels/rapid/GoogleCloudSDKInstaller.exe", "$env:Temp\GoogleCloudSDKInstaller.exe")

& $env:Temp\GoogleCloudSDKInstaller.exe
于 2020-02-07T21:23:53.643 回答