【发布时间】:2019-10-30 20:43:17
【问题描述】:
我正在尝试在 Windows 10 上安装 Django。
无论我尝试在 cmd 上使用 pip 安装什么,我都会收到这些错误
Collecting django
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)'))': /simple/django/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)'))': /simple/django/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)'))': /simple/django/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)'))': /simple/django/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)'))': /simple/django/
Could not fetch URL https://pypi.org/simple/django/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/django/ (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)'))) - skipping
Could not find a version that satisfies the requirement django (from versions: )
No matching distribution found for django
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: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)'))) - skipping
我从其他问题中尝试了很多东西,但都没有奏效。
pip install --upgrade pip --trusted-host pypi.org --trusted-host files.pythonhosted.org
pip install --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org django
【问题讨论】:
-
您的防火墙不允许 pip 连接到互联网,因此请允许来自 windows 防火墙的 pip 并且它将起作用
-
确保您有强大的互联网连接并允许防火墙连接到 pip 参考此 github.com/pypa/pip/issues/6152
-
@Exprator 互联网连接不是问题,所以它可能是公司的防火墙,我想我自己不能允许。还有其他安装 django 的方法吗?
-
进行跟踪路由可能会揭示它被阻塞的位置。从
cmd,尝试tracert pypi.python.org。如果您看到显示有*的地址,则表示它无法到达该跃点。 -
@FlipperPA 我确实 * 显示了,所以我猜它无法到达....这可能是因为公司的防火墙,我尝试了一些带有代理的命令,但似乎没有任何效果