<legend id='rG2dq'><style id='rG2dq'><dir id='rG2dq'><q id='rG2dq'></q></dir></style></legend>
  • <tfoot id='rG2dq'></tfoot>
    • <bdo id='rG2dq'></bdo><ul id='rG2dq'></ul>

        <i id='rG2dq'><tr id='rG2dq'><dt id='rG2dq'><q id='rG2dq'><span id='rG2dq'><b id='rG2dq'><form id='rG2dq'><ins id='rG2dq'></ins><ul id='rG2dq'></ul><sub id='rG2dq'></sub></form><legend id='rG2dq'></legend><bdo id='rG2dq'><pre id='rG2dq'><center id='rG2dq'></center></pre></bdo></b><th id='rG2dq'></th></span></q></dt></tr></i><div id='rG2dq'><tfoot id='rG2dq'></tfoot><dl id='rG2dq'><fieldset id='rG2dq'></fieldset></dl></div>

        <small id='rG2dq'></small><noframes id='rG2dq'>

      1. 由于证书过期,pip 在 MacOS 上出现 SSLError 失败 - 如何恢复?

        时间:2023-11-07
        <i id='LLyNI'><tr id='LLyNI'><dt id='LLyNI'><q id='LLyNI'><span id='LLyNI'><b id='LLyNI'><form id='LLyNI'><ins id='LLyNI'></ins><ul id='LLyNI'></ul><sub id='LLyNI'></sub></form><legend id='LLyNI'></legend><bdo id='LLyNI'><pre id='LLyNI'><center id='LLyNI'></center></pre></bdo></b><th id='LLyNI'></th></span></q></dt></tr></i><div id='LLyNI'><tfoot id='LLyNI'></tfoot><dl id='LLyNI'><fieldset id='LLyNI'></fieldset></dl></div>

        • <tfoot id='LLyNI'></tfoot>
            <tbody id='LLyNI'></tbody>
              <bdo id='LLyNI'></bdo><ul id='LLyNI'></ul>
              1. <legend id='LLyNI'><style id='LLyNI'><dir id='LLyNI'><q id='LLyNI'></q></dir></style></legend>

                <small id='LLyNI'></small><noframes id='LLyNI'>

                  本文介绍了由于证书过期,pip 在 MacOS 上出现 SSLError 失败 - 如何恢复?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在 MacOS (10.11.6) 上使用 pip 搜索或安装软件包时,我收到类似于下面重现的 SSL 错误.

                  When searching or installing packages with pip on MacOS (10.11.6), I am getting an SSL error similar to the one reproduced below.

                  python2 和 python3 都会出现此问题.我通过 www.python.org 作为框架获得了版本(2.7.14 和 3.6.5).pip 的版本是 9.0.1.这个问题是新问题(2018 年 4 月),似乎与 OSX 的更新有关.

                  The problem occurs for both python2 and python3. I acquired the versions (2.7.14 and 3.6.5) via www.python.org as Frameworks. The version of pip was 9.0.1. The problem is new (April 2018) and seems related to an update of OSX.

                  如何从这个问题中恢复?

                  How to recover from this problem?

                  $ pip2 search numpy
                  
                  Exception:
                  Traceback (most recent call last):
                    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
                      status = self.run(options, args)
                    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/commands/search.py", line 45, in run
                      pypi_hits = self.search(query, options)
                    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/commands/search.py", line 62, in search
                      hits = pypi.search({'name': query, 'summary': query}, 'or')
                    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1243, in __call__
                      return self.__send(self.__name, args)
                    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1602, in __request
                      verbose=self.__verbose
                    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/download.py", line 775, in request
                      headers=headers, stream=True)
                    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 522, in post
                      return self.request('POST', url, data=data, json=json, **kwargs)
                    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/download.py", line 386, in request
                      return super(PipSession, self).request(method, url, *args, **kwargs)
                    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 475, in request
                      resp = self.send(prep, **send_kwargs)
                    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 596, in send
                      r = adapter.send(request, **kwargs)
                    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/_vendor/cachecontrol/adapter.py", line 47, in send
                      resp = super(CacheControlAdapter, self).send(request, **kw)
                    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/_vendor/requests/adapters.py", line 497, in send
                      raise SSLError(e, request=request)
                  SSLError: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:661)
                  

                  推荐答案

                  有两种方法可以从这个问题中恢复.

                  There are two ways to recover from this problem.

                  解决方案 1.可以阅读 这里,Python.org 站点停止了对旧 TLS 版本的支持,这会破坏 pip <9.0.3.提供了一个新版本的 pip,但由于不能简单地通过损坏的 pip 进行更新,因此必须引导安装.这对我有用:

                  Solution 1. As can be read here, Python.org sites stopped the support for older TLS versions, which breaks pip < 9.0.3. A new release of pip was provided, but because one cannot simply update via the broken pip, one has to bootstrap the installation. This worked for me:

                  # For python2
                  curl https://bootstrap.pypa.io/get-pip.py | python2
                  # For python3 (haven't tested this myself)
                  curl https://bootstrap.pypa.io/get-pip.py | python3
                  

                  这些命令的功劳返回到这篇 SO 帖子.

                  Credits for these commands go back to this SO post.

                  解决方案 2.对于 Python 3.6 框架,脚本 Install Certificates.command 部署并安装在 /Applications/Python 3.6/ 下.执行它解决了问题,但仅适用于 pip3.

                  Solution 2. For Python 3.6 frameworks, a script Install Certificates.command is deployed and installed under /Applications/Python 3.6/. Executing it resolved the problem, but only for pip3.

                  这篇关于由于证书过期,pip 在 MacOS 上出现 SSLError 失败 - 如何恢复?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  • <bdo id='CKT4O'></bdo><ul id='CKT4O'></ul>

                    <small id='CKT4O'></small><noframes id='CKT4O'>

                    • <i id='CKT4O'><tr id='CKT4O'><dt id='CKT4O'><q id='CKT4O'><span id='CKT4O'><b id='CKT4O'><form id='CKT4O'><ins id='CKT4O'></ins><ul id='CKT4O'></ul><sub id='CKT4O'></sub></form><legend id='CKT4O'></legend><bdo id='CKT4O'><pre id='CKT4O'><center id='CKT4O'></center></pre></bdo></b><th id='CKT4O'></th></span></q></dt></tr></i><div id='CKT4O'><tfoot id='CKT4O'></tfoot><dl id='CKT4O'><fieldset id='CKT4O'></fieldset></dl></div>
                      1. <legend id='CKT4O'><style id='CKT4O'><dir id='CKT4O'><q id='CKT4O'></q></dir></style></legend>
                        <tfoot id='CKT4O'></tfoot>

                          <tbody id='CKT4O'></tbody>