欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

anacoda更新库时候出现失败HTTP 404 NOT FOUND for url 解决方法

程序员文章站 2022-05-31 20:18:04
...

win10+anacoda3
在更新所有库时候cnoda update --all时候出现以下代码

Solving environment: failed

CondaHTTPError: HTTP 404 NOT FOUND for url <https://conda.anaconda.org/'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/'/noarch/repodata.json>
Elapsed: 00:00.609577
CF-RAY: 471413c728102126-LAX

The remote server could not find the noarch directory for the
requested channel with url: https://conda.anaconda.org/'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/'

As of conda 4.3, a valid channel must contain a `noarch/repodata.json` and
associated `noarch/repodata.json.bz2` file, even if `noarch/repodata.json` is
empty. please request that the channel administrator create
`noarch/repodata.json` and associated `noarch/repodata.json.bz2` files.
$ mkdir noarch
$ echo '{}' > noarch/repodata.json
$ bzip2 -k noarch/repodata.json

You will need to adjust your conda configuration to proceed.
Use `conda config --show channels` to view your configuration's current state.
Further configuration help can be found at <https://conda.io/docs/config.html>.

是因为这个问题的出现是由于你conda安装好了之后,默认的镜像是官方的,由于官方的镜像在*,访问太慢或者不能访问,所以为了能够加快访问的速度,选择清华的镜像。
首先在prompt中输入以下:

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

然后在c盘中用户文件中搜索.condarc这个文件,如果没有就是隐藏了,我们可以通过ctrl+h来让隐藏文件显示出来。
接着用记事本打开,删掉-defaults和其他乱七八糟的东西,只剩下这种形式:

ssl_verify: true
channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
 
show_channel_urls: true

接着更新就好了!