CondaHTTPError:URLのHTTP000接続に失敗しました<https://mirrors.tuna.tsinghua.edu.cn/anaconda/pk

問題の説明:

condaを使用してパッケージをインストールすると、次のエラーが発生しました。

Collecting package metadata (repodata.json): failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/linux-64/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.
'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/linux-64'

原因分析:

明らかに、Webページへのアクセスに問題があります。他のソースを変更しようとしましたが、同じエラーが表示されました。最後に、オンラインで理由を見つけました。2つの状況があります。

解決:

vim ~/.condarc

まず、構成を確認します。

channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
  - defaults
show_channel_urls: true
default_channels:
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
custom_channels:
  conda-forge: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

以前のhttpsをhttpに変更するためにここにいます

channels:
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
  - defaults

一部のウィンドウでの解決策は、httpをhttpsに変更することです。これが、ネットワークセキュリティの理由になるはずです。httpsプロトコルは、安全なssl暗号化送信プロトコルであり、ブラウザとサーバー間の通信を暗号化して、データ送信のセキュリティを確保します。

condaオフラインインストール

上記の操作が機能しない場合でも、ネットワークは不良です。
ここに画像の説明を挿入します
Webサイトに直接アクセスしてインストールパッケージをダウンロードし、ダウンロード後、ダウンロードフォルダーに移動して実行します。

conda install --use-local pytorch-1.2.0-py3.7_cuda9.2.148_cudnn7.6.2_0.tar.bz2

インストールが成功すると、対応する圧縮パッケージと解凍されたフォルダーがcondaフォルダーの〜/ anaconda3 / pkgsサブフォルダーに表示されます。

実際、この手順はパッケージをサイトパッケージにインストールすることだけであり、実際には依存ライブラリのインストールを完了しません。したがって、引き続き実行できます。

conda install -c local pytorch

または、インストールコマンドを使用して再度インストールします。これにより、不足している依存ライブラリがチェックされ、ダウンロードしてインストールされます。

conda install XXX

おすすめ

転載: blog.csdn.net/qq_41917697/article/details/114577787