Linux 系統,conda create 報錯:“CondaHTTPError: HTTP 000 CONNECTION FAILED for url ”


Linux 系統,conda create 報錯:“CondaHTTPError: HTTP 000 CONNECTION FAILED for url ”

首先,一定要正確的安裝 anaconda(任何conda)。

1.問題描述:

Collecting package metadata (current_repodata.json): failed

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

2.錯誤原因:默認鏡像源訪問速度過慢,會導致超時從而導致更新和下載失敗。

3.解決方案:更換鏡像源為清華鏡像源,並且刪除默認鏡像源。

3.1.首先執行如下幾條命令更換清華鏡像源

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
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

恢復為清華的鏡像以后,我再次執行創建環境的命令,依舊是不成功。於是嘗試打開鏡像的地址“https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main”,打開以后看到的是以下界面:

1930873-20200307102004600-1840059319

可以看到....../pkgs/main,這個路徑指向不夠精確。

進入”C:\Users\Administrator“,打開“.condarc“,你將會看到以下代碼:

ssl_verify: true
show_channel_urls: true

channels:
  - httpn://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

將上述代碼更改為

ssl_verify: true
show_channel_urls: true

channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64

.condarc以點開頭,一般表示 conda 應用程序的配置文件,在用戶的家目錄(windows:C:\\users\\username\\,linux:/home/username/)。但對於.condarc配置文件,是一種可選的(optional)運行期配置文件,其默認情況下是不存在的,但當用戶第一次運行 conda config命令時,將會在用戶的家目錄創建該文件。

3.2.更改鏡像源配置文件

在用戶根目錄(C:Users用戶名)下找到.condarc文件,打開並並編輯,刪除其中的 -default配置行(這一點非常重要)。

3.3HTTP

如果還不行的話,就要把https 修改成http。

4.重新創建虛擬環境,成功!

[參考文獻]

解決Anaconda出現CondaHTTPError HTTP 000 CONNECTION FAILED for url問題

尤其推薦下面(非常推薦)

Anaconda建立新的環境,出現CondaHTTPError: HTTP 000 CONNECTION FAILED for url ...... 解決過程


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM