带有SSL证书的pip安装失败,验证失败(_ssl.c:833)

时间:2018-06-21 04:50:46

标签: python pip ssl-certificate

我无法通过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

任何建议永久解决此问题?

3 个答案:

答案 0 :(得分:2)

当我在需要外部网络访问权限代理的公司网络中时,我遇到了类似的问题。在这种情况下,我们必须告诉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

答案 1 :(得分:0)

我有一个类似的问题,发现与网络IPv6地址有关。我不知道为什么。解决我的问题的是禁用IPv6。您可以找到方法here for Windows and MacOS X

答案 2 :(得分:0)

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

或为pypi.org;files.pythonhosted.org

永久绕过代理(在 LAN设置中也有)

LAN settings - exceptions pypi.org;files.pythonhosted.org