【conda】配置国内镜像源

1、官方

https://docs.conda.io/projects/conda/en/latest/configuration.html

 

2、国内常用镜像

https://developer.aliyun.com/mirror/anaconda/

https://mirrors.tuna.tsinghua.edu.cn/anaconda/

 

 

3、配置

window和linux一样都是修改home目录下的.condarc文件

阿里源

channels:
  - defaults
show_channel_urls: true
default_channels:
  - http://mirrors.aliyun.com/anaconda/pkgs/main
  - http://mirrors.aliyun.com/anaconda/pkgs/r
  - http://mirrors.aliyun.com/anaconda/pkgs/msys2
custom_channels:
  conda-forge: http://mirrors.aliyun.com/anaconda/cloud
  msys2: http://mirrors.aliyun.com/anaconda/cloud
  bioconda: http://mirrors.aliyun.com/anaconda/cloud
  menpo: http://mirrors.aliyun.com/anaconda/cloud
  pytorch: http://mirrors.aliyun.com/anaconda/cloud
  simpleitk: http://mirrors.aliyun.com/anaconda/cloud

清华源

channels:
  - defaults
show_channel_urls: true
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

也可以命令行配置

#查看当前conda配置
conda config --show 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 --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
 
#设置搜索是显示通道地址
conda config --set show_channel_urls yes

 

4、清除缓存

配置完成可运行 conda clean -i 清除索引缓存。

 

5、恢复默认

# 全部删除
conda config --remove-key channels # 指定删除
conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud//pytorch/
conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/

官方配置

# ######################################################
# ##              Channel Configuration               ##
# ######################################################

# # channels (sequence: primitive)
# #   aliases: channel
# #   env var string delimiter: ','
# #   The list of conda channels to include for relevant operations.
# # 
# channels:
#   - defaults

# # channel_alias (str)
# #   The prepended url location to associate with channel names.
# # 
# channel_alias: https://conda.anaconda.org

# # default_channels (sequence: primitive)
# #   env var string delimiter: ','
# #   The list of channel names and/or urls used for the 'defaults'
# #   multichannel.
# # 
# default_channels:
#   - https://repo.anaconda.com/pkgs/main
#   - https://repo.anaconda.com/pkgs/r
......

 

 

 

 

参考链接:

https://blog.csdn.net/Trance95/article/details/124731504

https://blog.csdn.net/weixin_49779629/article/details/124053811

https://blog.csdn.net/u013066730/article/details/108616185

https://blog.csdn.net/u012811785/article/details/109440104

posted @ 2022-06-29 11:45  代码诠释的世界  阅读(9859)  评论(1编辑  收藏  举报