1 pip 提速
1.1 临时提速
在pip
命令中添加参数 -i
和镜像
常用镜像如下:
- 清华:https://pypi.tuna.tsinghua.edu.cn/simple
- 阿里云:http://mirrors.aliyun.com/pypi/simple/
- 中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
- 华中理工大学:http://pypi.hustunique.com/
- 山东理工大学:http://pypi.sdutlinux.org/
- 豆瓣:http://pypi.douban.com/simple/
使用:
假设使用清华镜像下载tensorflow
pip install tensorflow -i https://pypi.tuna.tsinghua.edu.cn/simple pyspider
1.2 设置配置文件,永久提速
修改 ~/.pip/pip.conf
(没有就创建一个文件夹及文件。文件夹要加“.”,表示是隐藏文件夹)
内容如下:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
亲测速度大幅度提升
2 conda 提速
终端直接运行一下命令
# 添加 Anaconda 的 TUNA 镜像
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
# TUNA 的 help 中镜像地址加有引号,需要去掉
# 设置搜索时显示通道地址
conda config --set show_channel_urls yes