pip国内的一些镜像
python国内源
阿里云 https://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣(douban) http://pypi.douban.com/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
修改源
临时使用:
可以在使用pip的时候在后面加上-i参数,指定pip源为国内源
|
1 |
eg: pip install scrapy -i https://pypi.tuna.tsinghua.edu.cn/simple |
永久修改:
Linux/macOS:
修改 ~/.pip/pip.conf (没有就创建一个), 内容如下:
|
1 2 |
[global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple |
对于当前用户不是root,而有时候需要使用sudo安装的情况,上述设置是无效的。需要在root用户目录也设置一下,一般情况下配置文件默认是/root/.pip/pip.conf。
Windows:
直接在user目录中创建一个pip目录,如:C:\Users\xx\pip,新建文件pip.ini,内容如下
|
1 2 |
[global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple |