conda无法创建虚拟环境并且无法安装其他第三方包
解决Anaconda出现CondaHTTPError: HTTP 000 CONNECTION FAILED for url问题
1.问题描述:conda无法创建虚拟环境并且无法安装其他第三方包,报错内容如下:
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/main/win-64/current_repodata.json><br>Elapsed: -<br><br>An HTTP error occurred when trying to retrieve this URL.<br>HTTP errors are often intermittent, and a simple retry will get you on your way.<br><br>If your current network has https://www.anaconda.com blocked, please file<br>a support request with your network engineering team.<br><br>SSLError(MaxRetryError('HTTPSConnectionPool(host=\'repo.anaconda.com\', port=443): Max retries exceeded with url: /pkgs/main/win-64/current_repodata.json (Caused by SSLError(SSLError("bad handshake: SysCallError(10054, \'WSAECONNRESET\')")))'))<br>
2.错误原因:默认镜像源访问速度过慢,会导致超时从而导致更新和下载失败。
3.解决方案:更换镜像源为清华镜像源,并且删除默认镜像源。
3.1.首先执行如下几条命令更换清华镜像源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
3.2.更改镜像源配置文件
在用户根目录(C:\Users\用户名)下找到.condarc文件,打开并并编辑,删除其中的default配置行。
4.重新创建虚拟环境,成功!