解决pip下载速度慢的问题

Linux及Mac环境

1.编辑pip.conf

mkdir -p ~/.pip
vim ~/.pip/pip.conf

2.更换国内源

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = https://pypi.tuna.tsinghua.edu.cn

3.临时使用:

可以在使用pip的时候在后面加上-i参数,指定pip源 
pip install scrapy -i https://pypi.tuna.tsinghua.edu.cn/simple

4.pip国内的一些镜像

  阿里云 http://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/ 
  中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/

Windows环境

1.点击此电脑,在最上面的的文件夹窗口输入 : %APPDATA%
2.按回车跳转到以下目录,新建pip文件夹
3.创建pip.ini文件

[global]
timeout = 6000
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn
Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐