Python 安装第三方库,超时报错--Read timed out 的两种解决方法(pip)
Traceback (most recent call last):
File "/home/xiaoduc/.pyenv/versions/3.5.0/lib/python3.5/site-packages/pip/_vendor/requests/packages/urllib3/response.py", line 228, in _error_catcher
yield
File "/home/xiaoduc/.pyenv/versions/3.5.0/lib/python3.5/site-packages/pip/_vendor/requests/packages/urllib3/response.py", line 310, in read
data = self._fp.read(amt)
File "/home/xiaoduc/.pyenv/versions/3.5.0/lib/python3.5/site-packages/pip/_vendor/cachecontrol/filewrapper.py", line 49, in read
data = self.__fp.read(amt)
File "/home/xiaoduc/.pyenv/versions/3.5.0/lib/python3.5/http/client.py", line 433, in read
n = self.readinto(b)
File "/home/xiaoduc/.pyenv/versions/3.5.0/lib/python3.5/http/client.py", line 473, in readinto
n = self.fp.readinto(b)
File "/home/xiaoduc/.pyenv/versions/3.5.0/lib/python3.5/socket.py", line 571, in readinto
return self._sock.recv_into(b)
File "/home/xiaoduc/.pyenv/versions/3.5.0/lib/python3.5/ssl.py", line 924, in recv_into
return self.read(nbytes, buffer)
File "/home/xiaoduc/.pyenv/versions/3.5.0/lib/python3.5/ssl.py", line 786, in read
return self._sslobj.read(len, buffer)
File "/home/xiaoduc/.pyenv/versions/3.5.0/lib/python3.5/ssl.py", line 570, in read
v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/xiaoduc/.pyenv/versions/3.5.0/lib/python3.5/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/home/xiaoduc/.pyenv/versions/3.5.0/lib/python3.5/site-packages/pip/commands/install.py", line 299, in run
requirement_set.prepare_files(finder)
File "/home/xiaoduc/.pyenv/versions/3.5.0/lib/python3.5/site-packages/pip/req/req_set.py", line 370, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/home/xiaoduc/.pyenv/versions/3.5.0/lib/python3.5/site-packages/pip/req/req_set.py", line 587, in _prepare_file
session=self.session, hashes=hashes)
File "/home/xiaoduc/.pyenv/versions/3.5.0/lib/python3.5/site-packages/pip/download.py", line 810, in unpack_url
hashes=hashes
File "/home/xiaoduc/.pyenv/versions/3.5.0/lib/python3.5/site-packages/pip/download.py", line 649, in unpack_http_url
hashes)
File "/home/xiaoduc/.pyenv/versions/3.5.0/lib/python3.5/site-packages/pip/download.py", line 871, in _download_http_url
_download_url(resp, link, content_file, hashes)
File "/home/xiaoduc/.pyenv/versions/3.5.0/lib/python3.5/site-packages/pip/download.py", line 595, in _download_url
hashes.check_against_chunks(downloaded_chunks)
File "/home/xiaoduc/.pyenv/versions/3.5.0/lib/python3.5/site-packages/pip/utils/hashes.py", line 46, in check_against_chunks
for chunk in chunks:
File "/home/xiaoduc/.pyenv/versions/3.5.0/lib/python3.5/site-packages/pip/download.py", line 563, in written_chunks
for chunk in chunks:
File "/home/xiaoduc/.pyenv/versions/3.5.0/lib/python3.5/site-packages/pip/utils/ui.py", line 139, in iter
for x in it:
File "/home/xiaoduc/.pyenv/versions/3.5.0/lib/python3.5/site-packages/pip/download.py", line 552, in resp_read
decode_content=False):
File "/home/xiaoduc/.pyenv/versions/3.5.0/lib/python3.5/site-packages/pip/_vendor/requests/packages/urllib3/response.py", line 353, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "/home/xiaoduc/.pyenv/versions/3.5.0/lib/python3.5/site-packages/pip/_vendor/requests/packages/urllib3/response.py", line 320, in read
flush_decoder = True
File "/home/xiaoduc/.pyenv/versions/3.5.0/lib/python3.5/contextlib.py", line 77, in __exit__
self.gen.throw(type, value, traceback)
File "/home/xiaoduc/.pyenv/versions/3.5.0/lib/python3.5/site-packages/pip/_vendor/requests/packages/urllib3/response.py", line 233, in _error_catcher
raise ReadTimeoutError(self._pool, None, 'Read timed out.')
pip._vendor.requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed out.
1. 解决方法,设置超时时间
pip --default-timeout=100 install -U Pillow
2. 解决方法:用国内镜像下载
例如:
pip install --index https://pypi.mirrors.ustc.edu.cn/simple/ gevent==1.4.0
pip install -i https://pypi.douban.com/simple gevent==1.4.0
相关文章
- linux Python-安装sasl包的错误
- [转]windows下安装python MySQLdb及问题解决
- 2023最新版安装Python教程
- 不用pip官方源安装Python扩展库的方法(使用国内的镜像源)
- 《python 与数据挖掘 》一 第2章 Python基础入门
- Python 2.7中安装pip的方法及步骤
- gyp ERR! stack Error: Can‘t find Python executable “python“, you can set the PYTHON env variable.
- Python安装Scrapy
- windows 10 python 2.7和python3.6共存解决方法和pip安装
- Python爬虫技术--基础篇--面向对象高级编程(中)
- Python安装模块的几种方法
- 《精通Python网络爬虫:核心技术、框架与项目实战》——3.8 小结
- 基于Python解决双目标MVS问题【100010096】
- python 使用自定义的类方法
- 在 Python 中使用 Flet GUI 构建Fluuter具有自动完成搜索功能的英德词典
- Python 教程之如何使用 Streamlit 在 Python 中编写 SaaS(软件即服务)Web 应用程序
- 【转载】python的魔法方法———A Guide to Python's Magic Methods
- pip install --user 使用方法和注意事项——python中安装module库到用户packages路径中
- Ubuntu Server无桌面无显示器情况下虚拟屏幕xvfb的安装及设置—ubuntu18.04server服务器系统下为python安装虚拟显示器 (使用jupyter notebook在web端播放openai的gym下保存的运行视频——需安装ipython)
- 在windows下安装配置python开发环境及Ulipad开发工具(转)
- Selenium4 Python实现Page Factory设计模式,python新的定位方法