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/
    #默认通道
    https://repo.anaconda.com/pkgs/main/linux-64
    https://repo.anaconda.com/pkgs/main/noarch
    https://repo.anaconda.com/pkgs/r/linux-64
    https://repo.anaconda.com/pkgs/r/noarch

    以下是中国大陆可用的常用Conda镜像源:

    清华大学:https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
    中国科学技术大学(USTC):https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
    阿里云:https://mirrors.aliyun.com/anaconda/pkgs/free/
    南京大学:https://mirrors.nju.edu.cn/anaconda/pkgs/free/
    豆瓣:https://pypi.douban.com/simple/

    删除镜像源

    #删除所有已配置的镜像站点地址
    conda config --remove-key channels
    #删除特定的镜像站点配置
    conda config --remove-key channels.<channel_name>
    将<channel_name>替换为要删除的特定频道的名称。

    设置搜索时显示通道地址

    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/