anaconda更改镜像源相关代码
设置镜像源提高下载速度
·
anaconda更改镜像源相关代码
pip换源和conda换源是不同的
在anaconda里面,可以使用pip install的方法和conda install的方法安装库,这二者的源是不同的,需要使用不同的代码来换源。
假设换了conda 的源,然后使用pip install的方法进行安装,仍然使用的是默认的源。这一点一定要注意!
conda换源相关代码记录
添加删除镜像源
添加镜像源(以阿里云为例)
conda config --add channels http://mirrors.aliyun.com/anaconda/pkgs/main
conda config --add channels http://mirrors.aliyun.com/anaconda/pkgs/r
conda config --add channels http://mirrors.aliyun.com/anaconda/pkgs/msys2
conda config --add channels http://mirrors.aliyun.com/anaconda/pkgs/free
删除镜像源
conda config --remove channels http://mirrors.aliyun.com/anaconda/pkgs/msys2
删除所有镜像源(不包括default)
conda config --remove-key channels
其他设置
设置搜索时显示通道地址
conda config --set show_channel_urls yes
显示镜像源
显示当前所有的镜像源
conda config --show channels
显示镜像源和设置
conda config --show-sources
重要备注
conda换源时如果源无法使用,则也无法通过conda create语句创建新环境
2024.7.14实测conda的阿里云源无法使用
pip换源
添加源(以阿里云为例)
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
pip config set install.trusted-host mirrors.aliyun.com
注意,这里如果不添加第二句话,在pip install的时候,可能出现下面的报错
删除源
pip config unset global.index-url
查看当前有哪些源
pip config list
注:如果没有换源,只是默认源的话,输入pip config list是空行,什么也不显示,如下图所示

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐



所有评论(0)