安装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

不!!这行故障还是存在。

先到这里,这就是我一下午找遍全网也没解决问题的脑残操作,希望观众老爷看了之后能够解决你的问题。

本文作者:薄书

本文链接:https://www.cnblogs.com/aimoboshu/p/14520147.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   薄书  阅读(2300)  评论(0编辑  收藏  举报
编辑推荐:
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
阅读排行:
· 在鹅厂做java开发是什么体验
· 百万级群聊的设计实践
· WPF到Web的无缝过渡:英雄联盟客户端的OpenSilver迁移实战
· 永远不要相信用户的输入:从 SQL 注入攻防看输入验证的重要性
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
展开