conda配置国内镜像源

wylc123 1年前 ⋅ 463 阅读

1、conda配置镜像源:

使用conda进行安装时,访问的是国外的网络,所以下载和安装包时会特别慢。我们需要更换到国内镜像源地址,这里我更换到国内的清华大学地址。(永久添加镜像)

Windows和Linux 对于conda修改镜像源的方法一样

查看anaconda中已经存在的镜像源

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/conda-forge/

设置搜索时显示通道地址

conda config --set show_channel_urls yes

若不想按照上述步骤添加镜像,可使用以下命令直接指定安装时使用的镜像地址(以opencv为例):

conda install opencv -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/

2、pip使用国内镜像源

一般在使用conda install安装时会出现包无法找到或者安装失败的情况,此时可以使用pip install来尝试安装(以opencv为例):

pip install opencv

若安装速度过慢可单独指定安装镜像加快安装:

pip install opencv -i https://mirrors.aliyun.com/pypi/simple/

此处列举国内常用pip安装镜像:

清华:https://pypi.tuna.tsinghua.edu.cn/simple

阿里云:https://mirrors.aliyun.com/pypi/simple/

中国科技大学: https://pypi.mirrors.ustc.edu.cn/simple/

华中理工大学:https://pypi.hustunique.com/

山东理工大学:https://pypi.sdutlinux.org/

豆瓣:https://pypi.douban.com/simple/


相关文章推荐

全部评论: 0

    我有话说: