通过conda info命令查看当前的镜像源
设置conda的镜像源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/conda
conda config --set show_channel_urls yes
也可以将镜像源设置成文件夹
修改配置文件.condarc如下:
channels:
- file:///home/usr/pkgs/conda
使用conda安装python包时会在~/anaconda2/pkgs目录下进行缓存
pip的本地缓存为~/.cache/pip/wheels
通过-i可以置顶镜像源
pip install ./tensor2tensor-1.6.2-py2.py3-none-any.whl -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
pip使用本地文件夹作为镜像源:
pip install xxx.whl --no-index --find-links=file:///tmp/packages
1、命令行式指定镜像地址
pip install -i http://pypi.douban.com/simple/ packagename
2、配制成默认的话,需要创建或修改配置文件(linux的文件放在~/.pip/pip.conf,windows在%HOMEPATH%\pip\pip.ini,目录不存在,手动创建)
[druid@master .pip]$ pwd
/home/druid/.pip
[druid@master .pip]$ more pip.conf
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = pypi.tuna.tsinghua.edu.cn