anaconda创建虚拟环境报错:An HTTP error occurred when trying to retrieve this URL.

1.问题描述:conda无法创建虚拟环境并且无法安装其他第三方包,报错内容如下:

PS C:\Users\Administrator.DESKTOP-EEN44LR> conda create -n flask_py python=3.8
Collecting package metadata (current_repodata.json): failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/main/win-64/current_repodata.json>
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.

在这里插入图片描述
2.错误原因:默认镜像源访问速度过慢,会导致超时从而导致更新和下载失败。

3.解决方案:更换镜像源为清华镜像源,并且删除默认镜像源。

conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
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.1.更改镜像源配置文件

在用户根目录(C:\Users\用户名)下找到.condarc文件,打开并并编辑,删除其中的default配置行。
在这里插入图片描述
若是,依旧报错。修改c盘user文件夹下的 .condarc 文件中的
https 修改为 http
删除了 defaul
问题解决

猜你喜欢

转载自blog.csdn.net/BigData_Mining/article/details/107921755