Anaconda creates a virtual environment error: An HTTP error occurred when trying to retrieve this URL.

1. Problem description: Conda cannot create a virtual environment and cannot install other third-party packages. The error content is as follows:

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.

Insert picture description here
2. The reason for the error: The default mirror source access speed is too slow, which will cause timeout and cause update and download failures.

3. Solution: Change the mirror source to the Tsinghua mirror source, and delete the default mirror source.

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. Change the mirror source configuration file

Find the .condarc file in the user root directory (C:\Users\user name), open and edit it, and delete the default configuration line.
Insert picture description here
If yes, still report an error. Modify the
https in the .condarc file in the user folder of the c drive to http and
delete the defaul
problem.

Guess you like

Origin blog.csdn.net/BigData_Mining/article/details/107921755