问题描述
conda安装包的时候, 下载中断, 导致安装失败, 报错信息如下所示:
Error:
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pk
gs/pro/noarch/repodata.json.bz2>
Elapsed: -
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
If your current network has https://www.anaconda.com blocked, please file
a support request with your network engineering team.
ConnectionError(MaxRetryError("HTTPSConnectionPool(host='repo.anaconda.com', por
t=443): Max retries exceeded with url: /pkgs/pro/noarch/repodata.json.bz2 (Cause
d by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0
x0000000005046400>: Failed to establish a new connection: [WinError 10061] No co
nnection could be made because the target machine actively refused it',))",),)
原因分析
这是由于网络不稳定, 导致HTTP连接超时导致
解决办法
设置连接时长, 输出命令如下
conda config --set remote_read_timeout_secs 600.0
conda config --set remote_connect_timeout_secs 60.0
如果没有采用源的话, 建议使用源连接, 让下载更加快速. 清华源.