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
永久修改镜像源
- 进入根目录:
cd ~/
- 进入.pip目录
cd .pip
- 如果不存在文件夹就新建
mkdir .pip
,然后进入pip:cd .pip
- 创建pip.conf文件
touch pip.conf
- 编辑pip.conf:
vim pip.conf
- 写入配置
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple/
[install]
trusted-host = pypi.tuna.tsinghua.edu.cn
- 退出编辑:
:wq
- 看下是否保存成功:
cat pip.conf