Anacondaは仮想環境エラーを作成します:このURLを取得しようとしたときにHTTPエラーが発生しました。

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.解決策:ミラーソースをTsinghuaミラーソースに変更し、デフォルトのミラーソースを削除します。

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 \ user name)で.condarcファイルを見つけ、それを開いて編集し、デフォルトの構成行を削除します。
ここに写真の説明を挿入
はいの場合でも、エラーを報告します。cドライブのユーザーフォルダにある.condarcファイルの
httpsをhttpに変更し
、デフォルトの
問題削除します。

おすすめ

転載: blog.csdn.net/BigData_Mining/article/details/107921755