使用国内pip源安装库,提升安装速度

1.pip的镜像源是国外时,经常遇到‘time out’,我们只需要把源地址改为国内可用的镜像网站就可以避免这个问题。

# 目前来看,豆瓣好像会缺包,可以尝试其他pip源

pip --default-timeout=1000 install -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com -r requirements.txt

pip --default-timeout=1000 install -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
Django==4.0.1

2.下面为部分国内可用的镜像网站:

Python官方:https://pypi.python.org/simple

v2ex:http://pypi.v2ex.com/simple

阿里云:http://mirrors.aliyun.com/pypi/simple

清华大学:https://pypi.tuna.tsinghua.edu.cn/simple

中国科技大学:https://pypi.mirrors.ustc.edu.cn/simple

中国科学院:http://pypi.mirrors.opencas.cn/simple

douban:http://pypi.douban.com/simple

3.更改pycharm使用的pip源

cd E:\Python310\ && vim pip.ini

[global]  
timeout = 6000  
index-url = http://pypi.douban.com/simple/
trusted-host = pypi.douban.com

 

posted @ 2020-12-18 14:53  chenjianwen  阅读(103)  评论(0编辑  收藏  举报