python pip安装第三方库超时问题

python pip安装第三方库超时问题(raise ReadTimeoutError(self._pool, None, "Read timed out.")

不得不吐槽,有时候家里的网速,简直感人。。分分钟就掉眼泪,在命令行终端想下载jupyter

pip install jupyter

一直timeout!

raise ReadTimeoutError(self._pool, None, “Read timed out.”)
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host=‘files.pythonhosted.org’, port=443): Read timed out.

尝试了N次之后,不得不寻求其他途径,自然而然就想到了像一些安装软件常用的使用国内镜像一样,于是让我找到了,安装源,网速好的童鞋就直接pip install jupyter就好啦(羡慕别人家的孩纸┭┮﹏┭┮)

以下介绍了三种解决方案,自行选择,我用了第二种方案解决了

首先你先要有pip工具,至于怎么安装自行百度哦

pip下载超时解决方案

aise ReadTimeoutError(self._pool, None, ‘Read timed out.’)

方案一:对于比较小的库,可以延时处理
-------- pip --default-timeout=100 install -U pip
-------- pip --default-timeout=100 install 第三方库名

方案二:更换安装源
------------网上可以查找很多豆瓣源
https://pypi.tuna.tsinghua.edu.cn/simple/
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyecharts
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple 库名

比如,安装jupyter

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple jupyter

发现下载速度真的是快了好多!太赞了!
在这里插入图片描述
在这里插入图片描述
终于可以打开 jupyter notebook了,开心~下载这个折磨了我整整一下午的时间还不止啊

出错使用这种 :pip install --index-url https://pypi.tuna.tsinghua.edu.cn/simple/ lightgbm

附上常用的镜像地址

清华: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/

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple scrapy

永久修改镜像源

  1. 进入根目录:cd ~/
  2. 进入.pip目录 cd .pip
  3. 如果不存在文件夹就新建mkdir .pip,然后进入pip: cd .pip
  4. 创建pip.conf文件 touch pip.conf
  5. 编辑pip.conf:vim pip.conf
  6. 写入配置
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple/
[install]
trusted-host = pypi.tuna.tsinghua.edu.cn
  1. 退出编辑::wq
  2. 看下是否保存成功:cat pip.conf
    在这里插入图片描述
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值