安裝numpy:conda install nampy==1.16 時報錯An HTTP error occurred when trying to retrieve this URL.


安裝numpy:conda install nampy==1.16 時報錯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.

1、錯誤截圖

image-20210311110732968

2、方法一

原因是conda源加入了不知名的URL,現在不能使用了(或者廢棄)

# 重置源配置
conda config --remove-key channels 
# 重新添加清華源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/ 
conda config --set show_channel_urls yes
# 查看效果
cat ~/.condarc
(TF117) PS C:\Users\Dell> cat ~/.condarc                                                                                ssl_verify: true
show_channel_urls: true
report_errors: true
channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - defaults

失敗!!

3、方法二

# 更新conda
conda update -n base conda
CondaError: Downloaded bytes did not match Content-Length
  url: https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64/llvmlite-0.35.0-py37h34b8924_4.conda
  target_path: D:\Anaconda3\pkgs\llvmlite-0.35.0-py37h34b8924_4.conda
  Content-Length: 12989490
  downloaded bytes: 5160624

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

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64/matplotlib-base-3.3.4-py37h49ac443_0.conda>
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.

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64/pandas-1.2.3-py37hf11a4ad_0.conda>
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.
conda update -all

image-20210311154750851

更新也出錯!!

Collecting package metadata (current_repodata.json): done
Solving environment: done

# All requested packages already installed.
已經安裝完畢了

從報錯的情況看可能下載的太慢,之前清華源換了還是有問題。

在這里還原到默認狀態。

 conda config --remove-key channels    

又按照報錯信息手動刪除了一些文件

警告conda.gateways.disk.delete:unlink_or_rename_to_trash(140):無法刪除或重命名D:\ Anaconda3 \ pkgs \ qt-5.6.2-vc14_6.tar.bz2。 請手動刪除此文件(您可能需要重新啟動才能釋放文件句柄)
警告conda.gateways.disk.delete:unlink_or_rename_to_trash(140):無法刪除或重命名D:\ Anaconda3 \ pkgs \ qt-5.6.2-vc14_6 \ Library \ plugins \ sqldrivers \ qsqlite.dll。 請手動刪除此文件(您可能需要重新啟動才能釋放文件句柄)

再升級一下

# conda
conda update conda
# anaconda(升級anaconda前需要先升級conda)
conda update anaconda
# anaconda-navigator
conda update anaconda-navigator
# spyder
conda update spyder
# 所有包
conda update --all
# 盡量避免使用conda update --all命令,可能會出現部分包降級的問題

image-20210311165713244

安裝第一個命令過程后,我出現了一個錯誤:PackageNotInstalledError: Package is not installed in prefix,這個時候不用慌,輸入conda的命令基本上都是報錯,把終端關掉重新開啟就解決了。原文鏈接:https://blog.csdn.net/sv2008337/article/details/80235482

試一下。

上面的都行了,OK!

# 修改頻道 
conda config --add channels conda-forge
conda config --set channel_priority flexible

你以為這樣就解決了么?

image-20210311185219183

不!!這行故障還是存在。

先到這里,這就是我一下午找遍全網也沒解決問題的腦殘操作,希望觀眾老爺看了之后能夠解決你的問題。


免責聲明!

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



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