【Anaconda】更改默认镜像源

方法1:目前网上常用方法

打开Anaconda Prompt

在这里插入图片描述

使用添加镜像源命令

展示已有镜像源
conda config --show channels

添加镜像源(个人一般只用第二个)
conda config --add channels https://mirrors.aliyun.com/pypi/simple/
conda config --add channels https://pypi.tuna.tsinghua.edu.cn/simple/
conda config --add channels https://pypi.douban.com/
conda config --add channels https://pypi.mirrors.ustc.edu.cn/

删除指定镜像源
conda config --remove channels https://pypi.tuna.tsinghua.edu.cn/simple

删除全部镜像源
conda config --remove-key channels

存在的问题:下载第三方包的时候可能会显示该链接不安全,存在证书认证的问题

在这里插入图片描述
出现该问题的原因是这个网址存在安全认证风险
在这里插入图片描述

解决方法1:http变为https

若添加了上述镜像源依旧下载不了,则通过下述方式实现:
pip install 包名 -i https://pypi.tuna.tsinghua.edu.cn/simple

解决方法2:信任该网址

如果存在证书确认问题,就以这样的形式下载导入包
pip install xxx -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

上述两个解决方案都不太完美,每次下载第三方包都需要后缀一串命令

方法2:可用,但目前网上很少见

C盘搜索 '.condarc’文件

一般都在c盘用户目录下
在这里插入图片描述

修改为如下内容

show_channel_urls: true
default_channels:
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - http://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
channels:
  - defaults
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值