本文主要是介绍分析pip 下载原理(一):超时或者下载失败raise ReadTimeoutError(self._pool, None, 'Read timed out.') pip._vendor.urllib,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
时间紧张,未完待续....
网络环境差的时候需要我们独立的进行相对应的包下载离线安装,或者给pip 加上 国内的镜像源比如加上清华的镜像源:
参考网址:https://mirrors.tuna.tsinghua.edu.cn/help/pypi/
Microsoft Windows [版本 10.0.17134.1]
(c) 2018 Microsoft Corporation。保留所有权利。D:\download>pip install virtualenvwrapper-4.8.4.tar.gz
Processing d:\download\virtualenvwrapper-4.8.4.tar.gz
Collecting virtualenv (from virtualenvwrapper==4.8.4)WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)",)': /simple/virtualenv/Downloading https://files.pythonhosted.org/packages/84/3a/9d656ec2535fa5f6680d55ef93a05f890bd1b2ad6f2bf97b34a679abf365/virtualenv-20.0.13-py2.py3-none-any.whl (4.6MB)|███████████ | 1.6MB 8.4kB/s eta 0:05:56ERROR: Exception:
Traceback (most recent call last):File "d:\language\python\python36\lib\site-packages\pip\_vendor\urllib3\response.py", line 397, in _error_catcheryieldFile "d:\language\python\python36\lib\site-packages\pip\_vendor\urllib3\response.py", line 479, in readdata = self._fp.read(amt)File "d:\language\python\python36\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 62, in readdata = self.__fp.read(amt)File "d:\language\python\python36\lib\http\client.py", line 449, in readn = self.readinto(b)File "d:\language\python\python36\lib\http\client.py", line 493, in readinton = self.fp.readinto(b)File "d:\language\python\python36\lib\socket.py", line 586, in readintoreturn self._sock.recv_into(b)File "d:\language\python\python36\lib\ssl.py", line 1012, in recv_intoreturn self.read(nbytes, buffer)File "d:\language\python\python36\lib\ssl.py", line 874, in readreturn self._sslobj.read(len, buffer)File "d:\language\python\python36\lib\ssl.py", line 631, in readv = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed outDuring handling of the above exception, another exception occurred:Traceback (most recent call last):File "d:\language\python\python36\lib\site-packages\pip\_internal\cli\base_command.py", line 188, in mainstatus = self.run(options, args)File "d:\language\python\python36\lib\site-packages\pip\_internal\commands\install.py", line 345, in runresolver.resolve(requirement_set)File "d:\language\python\python36\lib\site-packages\pip\_internal\legacy_resolve.py", line 196, in resolveself._resolve_one(requirement_set, req)File "d:\language\python\python36\lib\site-packages\pip\_internal\legacy_resolve.py", line 359, in _resolve_oneabstract_dist = self._get_abstract_dist_for(req_to_install)File "d:\language\python\python36\lib\site-packages\pip\_internal\legacy_resolve.py", line 307, in _get_abstract_dist_forself.require_hashesFile "d:\language\python\python36\lib\site-packages\pip\_internal\operations\prepare.py", line 199, in prepare_linked_requirementprogress_bar=self.progress_barFile "d:\language\python\python36\lib\site-packages\pip\_internal\download.py", line 1064, in unpack_urlprogress_bar=progress_barFile "d:\language\python\python36\lib\site-packages\pip\_internal\download.py", line 924, in unpack_http_urlprogress_bar)File "d:\language\python\python36\lib\site-packages\pip\_internal\download.py", line 1152, in _download_http_url_download_url(resp, link, content_file, hashes, progress_bar)File "d:\language\python\python36\lib\site-packages\pip\_internal\download.py", line 861, in _download_urlhashes.check_against_chunks(downloaded_chunks)File "d:\language\python\python36\lib\site-packages\pip\_internal\utils\hashes.py", line 75, in check_against_chunksfor chunk in chunks:File "d:\language\python\python36\lib\site-packages\pip\_internal\download.py", line 829, in written_chunksfor chunk in chunks:File "d:\language\python\python36\lib\site-packages\pip\_internal\utils\ui.py", line 156, in iterfor x in it:File "d:\language\python\python36\lib\site-packages\pip\_internal\download.py", line 818, in resp_readdecode_content=False):File "d:\language\python\python36\lib\site-packages\pip\_vendor\urllib3\response.py", line 531, in streamdata = self.read(amt=amt, decode_content=decode_content)File "d:\language\python\python36\lib\site-packages\pip\_vendor\urllib3\response.py", line 496, in readraise IncompleteRead(self._fp_bytes_read, self.length_remaining)File "d:\language\python\python36\lib\contextlib.py", line 99, in __exit__self.gen.throw(type, value, traceback)File "d:\language\python\python36\lib\site-packages\pip\_vendor\urllib3\response.py", line 402, in _error_catcherraise ReadTimeoutError(self._pool, None, 'Read timed out.')
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.D:\download>pip install virtualenvwrapper-4.8.4.tar.gz
Processing d:\download\virtualenvwrapper-4.8.4.tar.gz
ERROR: Operation cancelled by user
WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.D:\download>pip install -i https://pypi.tuna.tsinghua.edu.cn/simple virtualenvwrapper-4.8.4.tar.gz
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Processing d:\download\virtualenvwrapper-4.8.4.tar.gz
Collecting virtualenv (from virtualenvwrapper==4.8.4)Downloading https://pypi.tuna.tsinghua.edu.cn/packages/84/3a/9d656ec2535fa5f6680d55ef93a05f890bd1b2ad6f2bf97b34a679abf365/virtualenv-20.0.13-py2.py3-none-any.whl (4.6MB)|████████████████████████████████| 4.6MB 273kB/s
Collecting virtualenv-clone (from virtualenvwrapper==4.8.4)Downloading https://pypi.tuna.tsinghua.edu.cn/packages/ba/f8/50c2b7dbc99e05fce5e5b9d9a31f37c988c99acd4e8dedd720b7b8d4011d/virtualenv_clone-0.5.3-py2.py3-none-any.whl
Collecting stevedore (from virtualenvwrapper==4.8.4)Downloading https://pypi.tuna.tsinghua.edu.cn/packages/e6/49/a35dd566626892d577e426dbe5ea424dd7fbe10645f2c1070dcba474eca9/stevedore-1.32.0-py2.py3-none-any.whl (43kB)|████████████████████████████████| 51kB 656kB/s
Requirement already satisfied: importlib-metadata<2,>=0.12; python_version < "3.8" in d:\language\python\python36\lib\site-packages (from virtualenv->virtualenvwrapper==4.8.4) (1.5.0)
Collecting importlib-resources<2,>=1.0; python_version < "3.7" (from virtualenv->virtualenvwrapper==4.8.4)Downloading https://pypi.tuna.tsinghua.edu.cn/packages/8f/36/e678bc02cad98e566fbd7e6711ab2f389fc9adfb1edbb9f553eae41f9f97/importlib_resources-1.4.0-py2.py3-none-any.whl
Requirement already satisfied: appdirs<2,>=1.4.3 in d:\language\python\python36\lib\site-packages\appdirs-1.4.3-py3.6.egg (from virtualenv->virtualenvwrapper==4.8.4) (1.4.3)
Requirement already satisfied: six<2,>=1.9.0 in d:\language\python\python36\lib\site-packages (from virtualenv->virtualenvwrapper==4.8.4) (1.10.0)
Collecting filelock<4,>=3.0.0 (from virtualenv->virtualenvwrapper==4.8.4)Downloading https://pypi.tuna.tsinghua.edu.cn/packages/93/83/71a2ee6158bb9f39a90c0dea1637f81d5eef866e188e1971a1b1ab01a35a/filelock-3.0.12-py3-none-any.whl
Collecting distlib<1,>=0.3.0 (from virtualenv->virtualenvwrapper==4.8.4)Downloading https://pypi.tuna.tsinghua.edu.cn/packages/7d/29/694a3a4d7c0e1aef76092e9167fbe372e0f7da055f5dcf4e1313ec21d96a/distlib-0.3.0.zip (571kB)|████████████████████████████████| 573kB 328kB/s
Collecting pbr!=2.1.0,>=2.0.0 (from stevedore->virtualenvwrapper==4.8.4)Downloading https://pypi.tuna.tsinghua.edu.cn/packages/7a/db/a968fd7beb9fe06901c1841cb25c9ccb666ca1b9a19b114d1bbedf1126fc/pbr-5.4.4-py2.py3-none-any.whl (110kB)|████████████████████████████████| 112kB 409kB/s
Requirement already satisfied: zipp>=0.5 in d:\language\python\python36\lib\site-packages (from importlib-metadata<2,>=0.12; python_version < "3.8"->virtualenv->virtualenvwrapper==4.8.4) (2.2.0)
Installing collected packages: importlib-resources, filelock, distlib, virtualenv, virtualenv-clone, pbr, stevedore, virtualenvwrapperRunning setup.py install for distlib ... doneRunning setup.py install for virtualenvwrapper ... done
Successfully installed distlib-0.3.0 filelock-3.0.12 importlib-resources-1.4.0 pbr-5.4.4 stevedore-1.32.0 virtualenv-20.0.13 virtualenv-clone-0.5.3 virtualenvwrapper-4.8.4
WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.D:\download>
pip 是个非常普通的python 下载工具,但是尽管简单常用,我们还是需要明白他的机制,以及增加运用的手段的灵活性
这篇关于分析pip 下载原理(一):超时或者下载失败raise ReadTimeoutError(self._pool, None, 'Read timed out.') pip._vendor.urllib的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!