背景信息:
pip 默认从官网下载,但官网在国外,国内连国外源速度感人(ノへ ̄、)
其中一个解决方法,就是换国内源。
1、目前常用的国内源(推荐 阿里源)
清华:https://pypi.tuna.tsinghua.edu.cn/simple
中科大:https://pypi.mirrors.ustc.edu.cn/simple/
阿里:https://mirrors.aliyun.com/pypi/simple/
豆瓣:http://pypi.douban.com/simple/
腾讯:http://mirrors.cloud.tencent.com/pypi/simple
2、使用方法(以安装 tensorflow 为例)
原来是:
pip3 install tensorflow
换源后:
# 以 清华 为例
pip3 install tensorflow -i https://pypi.tuna.tsinghua.edu.cn/simple
3、不想每次安装都带上-i http://xxx/pypi/simple
可以把国内源设置为默认源:
# 以 清华 为例
pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
本地写入地址:/Users/xxx/.config/pip/pip.conf