Conda换源踩坑2021-04-18

# 更新conda
conda update -n base conda
conda update -all

CondaHTTPError错误

Collecting package metadata (current_repodata.json): failed
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.ustc.edu.cn/anaconda/pkgs/free/linux-64/repodata.json>
Elapsed: -

咱们首先用ping检查一下网络比如 ping www.baidu.com
如果网络正常那么就是源的问题
显示现有的源

conda config --show channels

目前总结三个方向:
第一个就是添加国内源
第二个就是只用自带的默认源
第三个就是只用国内源
三种方法说不定就那个能行,同一个实验室下,一台是使用默认的源没有啥问题,第二台是只能用国内源才能正常下载,defaults 要删除才行。
修改.condarc文件跟下面原理一样只不过换成用vim ~/.condarc

1-添加源

conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes # 搜索时显示通道地址
conda config --set channel_priority flexible

2-恢复默认源

conda config --remove-key channels #移除现有源
conda config --add channels defaults #添加默认源

conda config --add channels bioconda
conda config --add channels conda-forge

3-只用国内源

conda config --remove-key channels #移除现有源
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
conda config --add channels http://mirrors.ustc.edu.cn/anaconda/pkgs/free/

我这里统一用的都是http的,有的也说可以加上s会好些。反正这东西试来试去最后能用就行。

Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

最后还有这个解决环境依赖问题,默认应该是严格,可以换成灵活。
conda config --set channel_priority flexible

conda clean #清理

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容