Python&Conda系列(亲测有效):【解决方案】Collecting package metadata (current_repodata.json): failed

avatar
作者
筋斗云
阅读量:1

【解决方案】Collecting package metadata (current_repodata.json): failed




问题描述

cmd下运行:conda install pylint -y,报错如下:

C:\Users\apr> conda install --name apr pylint -y Collecting package metadata (current_repodata.json): failed  CondaHTTPError: HTTP 000 CONNECTION FAILED for url https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-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/pkgs/main/win-64’ 

解决方案

估计是镜像源不行了。

1)运行:conda config --show-sources,从输出中找到.condarc文件的位置:

==> C:\Users\apr\.condarc <== 

2)打开C:\Users\apr.condarc文件(如果没有的话目测可以对应新建一个,但是路径不是apr,而是自己电脑上对应的用户名),将内容替换成:

channels:   - defaults show_channel_urls: true channel_alias: http://mirrors.tuna.tsinghua.edu.cn/anaconda 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   - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro   - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2 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 

3)再运行:conda install pylint -y,发现可以了。

小结

以上。

创作结束时间:2022年11月17日14:45:51

参考文献

【环境配置】Collecting package metadata (current_repodata.json): failed的问题解决 https://blog.csdn.net/qq_44747572/article/details/124457540
Collecting package metadata (current_repodata.json): failed(解决方案) https://blog.csdn.net/thy0000/article/details/122816027
conda channel的镜像设置(设置可用清华源) https://dalewushuang.blog.csdn.net/article/details/84782550







宇内虹游

【解决方案】Collecting package metadata (current_repodata.json): failed

广告一刻

为您即时展示最新活动产品广告消息,让您随时掌握产品活动新动态!