在linux系统,有时使用conda安装东西太慢了,几百兆的文件,要下载几十分钟,太离谱了;看了网络更多教程,结合实际情况,总结此文章。
换conda国内源,清华源、中科大、上海交大、阿里等等,这里选择其中一个即可。
conda换为清华源,执行如下命令
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/conda-forge
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --set show_channel_urls yes
测试一下,是否有加速;
如果上面的不起作用,可以在Linux系统中,通过修改condarc文件,进行配置conda的源
vim ~/.condarc
如果是在windows系统,是~/.condarc文件,在C盘的当前用户目录下,是一个隐藏文件;(需要设置conda config --add,才会生成的;)
改为如下所示:
show_channel_urls: true
channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
- 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 clean -i
测试一下,是否有加速;
如果想移除刚设置的源,并恢复官方默认的,执行如下命令:
conda config --remove-key channels
中科大Anaconda 源使用帮助 — USTC Mirror Help 文档
conda换为中科大源,执行如下命令
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/menpo/
conda config --set show_channel_urls yes
然后删除 - defaults 增加 ssl_verify: false;
移除刚设置的源,并恢复默认
conda config --remove-key channels
conda换为交源,执行如下命令
conda config --add channels https://mirror.sjtu.edu.cn/anaconda/pkgs/free
conda config --add channels https://mirror.sjtu.edu.cn/anaconda/pkgs/main
conda config --add channels https://mirror.sjtu.edu.cn/anaconda/pkgs/mro
conda config --add channels https://mirror.sjtu.edu.cn/anaconda/pkgs/msys2
conda config --set show_channel_urls yes
测试一下,是否有加速;
如果上面的不起作用,可以在Linux系统中,通过修改condarc文件,进行配置conda的源
vim ~/.condarc
如果是在windows系统,是~/.condarc文件,在C盘的当前用户目录下,是一个隐藏文件;(需要设置conda config --add,才会生成的;)
改为如下所示:
show_channel_urls: true
channel_alias: https://anaconda.mirrors.sjtug.sjtu.edu.cn/
default_channels:
- https://anaconda.mirrors.sjtug.sjtu.edu.cn/pkgs/main
- https://anaconda.mirrors.sjtug.sjtu.edu.cn/pkgs/free
- https://anaconda.mirrors.sjtug.sjtu.edu.cn/pkgs/mro
- https://anaconda.mirrors.sjtug.sjtu.edu.cn/pkgs/msys2
- https://anaconda.mirrors.sjtug.sjtu.edu.cn/pkgs/pro
- https://anaconda.mirrors.sjtug.sjtu.edu.cn/pkgs/r
custom_channels:
conda-forge: https://anaconda.mirrors.sjtug.sjtu.edu.cn/conda-forge
soumith: https://anaconda.mirrors.sjtug.sjtu.edu.cn/cloud/soumith
bioconda: https://anaconda.mirrors.sjtug.sjtu.edu.cn/cloud/bioconda
menpo: https://anaconda.mirrors.sjtug.sjtu.edu.cn/cloud/menpo
viscid-hub: https://anaconda.mirrors.sjtug.sjtu.edu.cn/cloud/viscid-hub
atztogo: https://anaconda.mirrors.sjtug.sjtu.edu.cn/cloud/atztogo
然后执行:
conda clean -i
测试一下,是否有加速;
在Linux系统中,通过修改condarc文件,进行配置conda的源
vim ~/.condarc
如果是在windows系统,是~/.condarc文件,在C盘的当前用户目录下,是一个隐藏文件;(需要设置conda config --add,才会生成的;)
改为如下所示:
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
然后执行:
conda clean -i
测试一下,是否有加速;
参考资源:
中科大Anaconda 源使用帮助 — USTC Mirror Help 文档
祝你顺利,,,