python pip安装openpyxl发生错误

问题描述

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

问题截图

pip 安装 openpyxl错误pip 安装 openpyxl错误

问题环境及思考

——我的电脑安装有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

问题解决截图

成功成功截图

附件:错误代码

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.
  • 1
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值