python pip安装openpyxl发生错误
2022-9-26 10:18:29 Author: www.freebuf.com(查看原文) 阅读量:13 收藏

freeBuf

主站

分类

漏洞 工具 极客 Web安全 系统安全 网络安全 无线安全 设备/客户端安全 数据安全 安全管理 企业安全 工控安全

特色

头条 人物志 活动 视频 观点 招聘 报告 资讯 区块链安全 标准与合规 容器安全 公开课

官方公众号企业安全新浪微博

FreeBuf.COM网络安全行业门户,每日发布专业的安全资讯、技术剖析。

FreeBuf+小程序

FreeBuf+小程序

准备使用openpyxl都excel表格进行操作,需要先进行安装openpyxl,安装时,发生错误。(不想麻烦直接看问题解决)

image
image

——我的电脑安装有python3.6和python3.7两个版本,默认python环境变量时python3.6。在cmd使用python.7 可使用python7版本。安装openpyxl时,需把cmd路径切换到python安装目录下的Scripts(E:\Python 3.7.0\Scripts),一开始准备把openpyxl安装到python7下scripts,可能应为python6版本问题冲突,无法正确安装,后再在python6目录下安装最后 安装失败提示——*(You are using pip version 9.0.3, however version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.)*因为 pip 版本陈旧,无法正确安装。

——需要先更新pip,再进行安装。(以后使用pip安装,都需先更新pip——python -m pip install --upgrade pip)共勉(我用的是python.7 -m pip install --upgrade pip 我用两个版本py6,py7)顺带简单说说两个python版本共存,你需要把不同pyton版本安装再不同路径下,需添加两个python环境变量,然后需要需改一个python安装目录下的python.exe 文件名,用于区分两个不同版本的python。(我把py7目录下的python.exe,修改为python.7.exe,所以再py7下安装使用这句命令python.7 -m pip install --upgrade pip)

`python -m pip install --upgrade pip`
pip install openpyxl

image
image

附件:错误代码

C:\Users\root\AppData\Local\Programs\Python\Python36\Scripts>pip install openpyxl
Collecting openpyxl
  Cache entry deserialization failed, entry ignored
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000002551A6E7550>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed',)': /packages/95/8c/83563c60489954e5b80f9e2596b93a68e1ac4e4a730deb1aae632066d704/openpyxl-3.0.3.tar.gz
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000002551A6E7240>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed',)': /packages/95/8c/83563c60489954e5b80f9e2596b93a68e1ac4e4a730deb1aae632066d704/openpyxl-3.0.3.tar.gz
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000002551A6E83C8>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed',)': /packages/95/8c/83563c60489954e5b80f9e2596b93a68e1ac4e4a730deb1aae632066d704/openpyxl-3.0.3.tar.gz
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)",)': /packages/95/8c/83563c60489954e5b80f9e2596b93a68e1ac4e4a730deb1aae632066d704/openpyxl-3.0.3.tar.gz
  Downloading https://files.pythonhosted.org/packages/95/8c/83563c60489954e5b80f9e2596b93a68e1ac4e4a730deb1aae632066d704/openpyxl-3.0.3.tar.gz (172kB)
    11% |███▉                            | 20kB 697bytes/s eta 0:03:39Exception:
Traceback (most recent call last):
  File "c:\users\root\appdata\local\programs\python\python36\lib\site-packages\pip\_vendor\urllib3\response.py", line 302, in _error_catcher
    yield
  File "c:\users\root\appdata\local\programs\python\python36\lib\site-packages\pip\_vendor\urllib3\response.py", line 384, in read
    data = self._fp.read(amt)
  File "c:\users\root\appdata\local\programs\python\python36\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 60, in read
    data = self.__fp.read(amt)
  File "c:\users\root\appdata\local\programs\python\python36\lib\http\client.py", line 449, in read
    n = self.readinto(b)
  File "c:\users\root\appdata\local\programs\python\python36\lib\http\client.py", line 493, in readinto
    n = self.fp.readinto(b)
  File "c:\users\root\appdata\local\programs\python\python36\lib\socket.py", line 586, in readinto
    return self._sock.recv_into(b)
  File "c:\users\root\appdata\local\programs\python\python36\lib\ssl.py", line 1009, in recv_into
    return self.read(nbytes, buffer)
  File "c:\users\root\appdata\local\programs\python\python36\lib\ssl.py", line 871, in read
    return self._sslobj.read(len, buffer)
  File "c:\users\root\appdata\local\programs\python\python36\lib\ssl.py", line 631, 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 "c:\users\root\appdata\local\programs\python\python36\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "c:\users\root\appdata\local\programs\python\python36\lib\site-packages\pip\commands\install.py", line 335, in run
    wb.build(autobuilding=True)
  File "c:\users\root\appdata\local\programs\python\python36\lib\site-packages\pip\wheel.py", line 749, in build
    self.requirement_set.prepare_files(self.finder)
  File "c:\users\root\appdata\local\programs\python\python36\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "c:\users\root\appdata\local\programs\python\python36\lib\site-packages\pip\req\req_set.py", line 620, in _prepare_file
    session=self.session, hashes=hashes)
  File "c:\users\root\appdata\local\programs\python\python36\lib\site-packages\pip\download.py", line 821, in unpack_url
    hashes=hashes
  File "c:\users\root\appdata\local\programs\python\python36\lib\site-packages\pip\download.py", line 659, in unpack_http_url
    hashes)
  File "c:\users\root\appdata\local\programs\python\python36\lib\site-packages\pip\download.py", line 882, in _download_http_url
    _download_url(resp, link, content_file, hashes)
  File "c:\users\root\appdata\local\programs\python\python36\lib\site-packages\pip\download.py", line 603, in _download_url
    hashes.check_against_chunks(downloaded_chunks)
  File "c:\users\root\appdata\local\programs\python\python36\lib\site-packages\pip\utils\hashes.py", line 46, in check_against_chunks
    for chunk in chunks:
  File "c:\users\root\appdata\local\programs\python\python36\lib\site-packages\pip\download.py", line 571, in written_chunks
    for chunk in chunks:
  File "c:\users\root\appdata\local\programs\python\python36\lib\site-packages\pip\utils\ui.py", line 139, in iter
    for x in it:
  File "c:\users\root\appdata\local\programs\python\python36\lib\site-packages\pip\download.py", line 560, in resp_read
    decode_content=False):
  File "c:\users\root\appdata\local\programs\python\python36\lib\site-packages\pip\_vendor\urllib3\response.py", line 436, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "c:\users\root\appdata\local\programs\python\python36\lib\site-packages\pip\_vendor\urllib3\response.py", line 401, in read
    raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
  File "c:\users\root\appdata\local\programs\python\python36\lib\contextlib.py", line 99, in __exit__
    self.gen.throw(type, value, traceback)
  File "c:\users\root\appdata\local\programs\python\python36\lib\site-packages\pip\_vendor\urllib3\response.py", line 307, in _error_catcher
    raise ReadTimeoutError(self._pool, None, 'Read timed out.')
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
You are using pip version 9.0.3, however version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

文章来源: https://www.freebuf.com/articles/others-articles/335437.html
如有侵权请联系:admin#unsafe.sh