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 
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.

anaconda创建虚拟环境报错:An HTTP error occurred when trying to retrieve this URL._第1张图片
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配置行。
anaconda创建虚拟环境报错:An HTTP error occurred when trying to retrieve this URL._第2张图片
若是,依旧报错。修改c盘user文件夹下的 .condarc 文件中的
https 修改为 http
删除了 defaul
问题解决

你可能感兴趣的:(Python)