【问题标题】:pip install fail with SSL certificate verify failed (_ssl.c:833)pip install failed with SSL certificate verify failed (_ssl.c:833)
【发布时间】:2018-11-30 07:36:21
【问题描述】:

我无法通过 pip install 安装任何外部 python 模块。 我已经正确安装了 python,但是如果我使用 pip_install 它会显示这个错误。

这是我运行pip install pytesseract后的代码

 C:\Users\190560>pip install pytesseract
Collecting pytesseract
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'),)': /simple/pytesseract/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'),)': /simple/pytesseract/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'),)': /simple/pytesseract/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'),)': /simple/pytesseract/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'),)': /simple/pytesseract/
  Could not fetch URL https://pypi.org/simple/pytesseract/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pytesseract/ (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'),)) - skipping
  Could not find a version that satisfies the requirement pytesseract (from versions: )
No matching distribution found for pytesseract
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'),)) - skipping

我该如何解决这个问题??

使用这个命令我可以部分解决问题

pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org <package_name>

但我无法在我的计算机上找到任何 pip.ini 文件夹,如建议的那样 this question here

有什么建议可以永久解决这个问题吗?

【问题讨论】:

  • 您在公司网络中工作吗?
  • @srj 不,我没有使用任何公司网络!!
  • 有几种不同的因素会导致这种情况。首先,请参阅this question。按照install -U pip setuptools 的答案去做。如果可行,看看pip 现在是否可以在没有trusted-host 的情况下工作。如果是这样,那是你的问题。如果没有,您需要向您提供更多信息:您使用的平台、Python 版本以及安装方式(python.org 安装程序、apt-get 等)、哪些步骤失败以及输出是什么.
  • @abarnert 我使用的是 Windows 10 平台,我使用的是最新版本的 python,即 python 3.6.5。我通过 python.org 安装程序安装了它。我唯一失败的步骤是我上面提到的那一步,并且还指定了错误。
  • 您是否使用-U pip setuptools 完成了pip install --trusted-host &lt;etc.&gt;?至少在某些情况下,这就是您将临时/部分解决方案转变为永久解决方案的方式,这就是我要求您这样做的原因。

标签: python pip ssl-certificate


【解决方案1】:

当我在需要代理才能访问外部网络的公司网络中时,我遇到了类似的问题。在这种情况下,我们必须告诉 pip 代理:

pip --proxy=http://your.corporate.proxy.com  install pytesseract

另一个可能的原因是由于 pypi 域更改。在这种情况下,您可以尝试以下解决方案:

pip --index-url=http://pypi.python.org/simple/ --trusted-host pypi.python.org install pytesseract

另一个类似案例,答案很好:pip always fails ssl verification

【讨论】:

  • 我在一个 sorporate 代理背后,它真的帮助了我。谢谢!
【解决方案2】:

我遇到了类似的问题,发现与网络 IPv6 地址有关。我不知道为什么。解决我的问题是禁用 IPv6。你可以找到如何做到这一点here for Windows and MacOS X

【讨论】:

    【解决方案3】:

    Windows 上,如果使用代理,请在控制面板 - Internet 选项 - 连接 - LAN 设置中暂时禁用它

    或为pypi.org;files.pythonhosted.org 永久绕过代理(也存在于LAN 设置中

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-10-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-30
      • 2016-01-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多