首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >无法安装google:"<gcloud.components.update>未能获取组件“Windows7

无法安装google:"<gcloud.components.update>未能获取组件“Windows7
EN

Stack Overflow用户
提问于 2015-05-25 14:52:47
回答 2查看 11.2K关注 0票数 3

当我尝试输入所有google时,会发生以下错误:

错误:(gcloud.components.update)无法从服务器获取组件列表。检查网络设置,然后再试一次。Google安装程序现在将退出。按任意键继续。。。

代码语言:javascript
运行
复制
result = func(*args)   File "C:\python27_x64\lib\urllib2.py", line 1222, in https_open
return self.do_open(httplib.HTTPSConnection, req)   File "C:\python27_x64\lib\urllib2.py", line 1184, in do_open
raise URLError(err) urllib2.URLError: <urlopen error [Errno 10061] No connection could be made because the target machine actively refused it>

有什么想法吗?

EN

回答 2

Stack Overflow用户

发布于 2015-05-26 02:55:24

我在安装时和在另一个先前工作的安装上的某些命令上都有类似的错误。在浏览并添加了一些日志之后,看起来SSL证书验证对于来自Google服务器的组件列表请求失败了:

代码语言:javascript
运行
复制
$ gcloud preview managed-instance-groups ...
You do not currently have this command group installed.  Using it requires the installation of components: [preview]
Could not fetch [https://dl.google.com/dl/cloudsdk/release/components-2.json]
<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)>
ERROR: (gcloud) Failed to fetch component listing from server. Check your network settings and try again.

为了解决这个问题(以一种几乎肯定是不可取的方式),我禁用了该单个请求的SSL证书验证。如果您想沿着这条路径走下去,请在

代码语言:javascript
运行
复制
./google-cloud-sdk/lib/googlecloudsdk/core/updater/installers.py:248

发自:

代码语言:javascript
运行
复制
return urllib2.urlopen(req, timeout=TIMEOUT_IN_SEC)

至:

代码语言:javascript
运行
复制
return urllib2.urlopen(req, timeout=TIMEOUT_IN_SEC, context=ssl.SSLContext(ssl.PROTOCOL_TLSv1))

(https://code.google.com/p/google-cloud-sdk/issues/detail?id=143上有一个问题。)

更新: 26/05/15

在我的例子中,这是我安装的OpenSSL版本与Python引用的OpenSSL版本之间的不匹配(这可能是在更新到OpenSSL@1.0.2a-1之后开始发生的)。

为了解决这个问题,我将我的OpenSSL版本更新为最新版本:

代码语言:javascript
运行
复制
brew update
brew upgrade openssl

然后,我重新安装了Python,引用了这个更新版本的OpenSSL:

代码语言:javascript
运行
复制
brew uninstall python
brew install python --with-brewed-openssl

在此之后,我被Google安装(因为我在那里混了一会儿以找到解决方案;您可能不需要这样做)并从头开始安装:

代码语言:javascript
运行
复制
curl https://sdk.cloud.google.com | bash

我们是黄金!

有关OS中这些OpenSSL问题的进一步阅读,请参阅本文:https://hynek.me/articles/apple-openssl-verification-surprises/

票数 3
EN

Stack Overflow用户

发布于 2016-03-14 22:48:44

TL;博士

  1. 找到谷歌脚本使用的cacerts.txt文件。应该在<google-cloud-sdk>/lib/third_party/httplib2/cacerts.txt
  2. 在火狐中打开https://dl.google.com并导出其证书。
  3. 将证书的内容复制到cacerts.txt文件的末尾。

您可能还需要make sure your system's openssl version is the same version as the openssl that's used by python, as of jemartti's answer。我试过了但这还不够。我不知道这是否必要。

为达到此解决方案而采取的步骤

在尝试jemartti's answer失败后,我使用了--verbosity debug标志来跟踪故障点。产出如下:

调试:无法获取"/usr/local/google-cloud-sdk/lib/googlecloudsdk/core/updater/snapshots.py",跟踪(最近一次调用):文件[https://dl.google.com/dl/cloudsdk/channels/rapid/components-v100.0.0.json]行186,在_DictFromURL response = installers.ComponentInstaller.MakeRequest(url,command_path)文件"/usr/local/google-cloud-sdk/lib/googlecloudsdk/core/updater/installers.py",第277行,在MakeRequest返回urlopen_with_cacerts.urlopen(req,文件"/usr/local/google-cloud-sdk/lib/googlecloudsdk/core/util/urlopen_with_cacerts.py",第40行,在urlopen返回orig_urlopen(*args,**kwargs)文件"/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py",第154行中,在urlopen返回opener.open(url,data,文件"/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py",行431,在self._open(req,data)文件"/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py",行449中,在_open '_ open‘中,( req)文件"/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py",行409,在_call_chain result = func(*args)文件"/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py",行1240中,文件"/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py",第1197行,在do_open context=self._context(错误)URLError中:

因此,我打开了/usr/local/google-cloud-sdk/core/util/urlopen_with_cacerts.py,看到它使用从httplib2.CA_CERTS获得的cafile参数调用了httplib2urlopen方法。我添加了一行打印该httplib2.CA_CERTS的行,输出为:

/usr/local/google-cloud-sdk/lib/third_party/httplib2/cacerts.txt

然后,as described in this answer,这就是我这么做的原因:

  1. 在Firefox中打开URL并导出证书。
  2. 将证书的内容复制到cacerts.txt文件的末尾。

作为Mac用户,我还使用了the one-liner described here (出于某些原因产生了与Firefox的证书导出特性不同的证书),以便在我的计算机上保存证书(根据需要替换exmple.comexample.crt ):

代码语言:javascript
运行
复制
openssl x509 -in <(openssl s_client -connect example.com:443 -prexit 2>/dev/null) -out ~/example.crt
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30441026

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档