首页 > 解决方案 > Pycharm 由于 SSL 安装包失败

问题描述

我正在使用 Windows 7 虚拟机,但无法添加 ctypes。我的物理机运行 Ubuntu,互联网连接是 WiFi 热点。

发生了错误:

无法获取 URL https://pypi.org/simple/ctypes/:确认 ssl 证书时出现问题:HTTPSConnectionPool(host='pypi.org', port=443):最大重试次数超过 url:/simple/ ctypes/ (由 SSLError(SSLError(1, '_ssl.c:499: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version')) - 跳过

命令输出:

收集 ctypes 无法获取 URL https://pypi.org/simple/ctypes/:确认 ssl 证书时出现问题:HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: / simple/ctypes/(由 SSLError(SSLError(1, '_ssl.c:499: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version') 引起) - 跳过无法获取 URL https://pypi。 org/simple/pip/ : 确认 ssl 证书时出现问题:HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (由 SSLError(SSLError(1 , '_ssl.c:499: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'),)) - 跳过

C:\Python27\lib\site-packages\pip-10.0.1-py2.7.egg\pip\_vendor\urllib3\util\ssl_.py:339: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  SNIMissingWarning
C:\Python27\lib\site-packages\pip-10.0.1-py2.7.egg\pip\_vendor\urllib3\util\ssl_.py:137: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecurePlatformWarning
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '_ssl.c:499: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'),)': /simple/ctypes/
C:\Python27\lib\site-packages\pip-10.0.1-py2.7.egg\pip\_vendor\urllib3\util\ssl_.py:137: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecurePlatformWarning
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '_ssl.c:499: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'),)': /simple/ctypes/
C:\Python27\lib\site-packages\pip-10.0.1-py2.7.egg\pip\_vendor\urllib3\util\ssl_.py:137: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecurePlatformWarning
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '_ssl.c:499: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'),)': /simple/ctypes/
C:\Python27\lib\site-packages\pip-10.0.1-py2.7.egg\pip\_vendor\urllib3\util\ssl_.py:137: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecurePlatformWarning
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '_ssl.c:499: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'),)': /simple/ctypes/
C:\Python27\lib\site-packages\pip-10.0.1-py2.7.egg\pip\_vendor\urllib3\util\ssl_.py:137: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecurePlatformWarning
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '_ssl.c:499: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'),)': /simple/ctypes/
C:\Python27\lib\site-packages\pip-10.0.1-py2.7.egg\pip\_vendor\urllib3\util\ssl_.py:137: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecurePlatformWarning
  Could not find a version that satisfies the requirement ctypes (from versions: )
No matching distribution found for ctypes
C:\Python27\lib\site-packages\pip-10.0.1-py2.7.egg\pip\_vendor\urllib3\util\ssl_.py:137: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecurePlatformWarning

标签: pythonsslpycharm

解决方案


尝试升级您的 urllib 安全包,例如通过 pip。

pip install urllib3[secure]

这应该可以指导您: https ://urllib3.readthedocs.io/en/latest/user-guide.html#ssl-py2

您的 urllib 似乎尝试使用 tlsv1 访问 pypi。他们很可能不再允许您这样做。

让你的工具链保持最新,你应该没问题。

更新:

如何在不同版本的 Windows 上使用 pip 进行操作已在此处得到解答:如何在 Windows 上安装 pip?


推荐阅读