pip install 타 임 스 오류 시간 초과 (pip. vendor. requests. packages. urllib 3. exceptions. ReadTimeoutError: HTTPSConnect) 솔 루 션
5355 단어 script-python
오늘 pip install django 를 설치 할 때 항상 설치 실 패 를 알 립 니 다. 시간 초과 알림 (pip. vendor. requests. packages. urllib 3. exceptions. ReadTimeoutError: HTTPSConnectionPool (host = 'files. python hosted. org', port = 443): 다음 과 같은 전체 오류 정 보 를 읽 습 니 다.
(venv) C:\Users\user\PycharmProjects\aijoke_DRF>pip install django
Collecting django
Downloading https://files.pythonhosted.org/packages/ca/ab/5e004afa025a6fb640c6e983d4983e6507421ff01be224da79ab7de7a21f/Django-3.0.8-py3-none-any.whl (7.5MB)
20% |██████▌ | 1.5MB 7.1kB/s eta 0:13:57Exception:
Traceback (most recent call last):
File "C:\Users\user\PycharmProjects\aijoke_DRF\venv\lib\site-packages\pip-9.0.1-py3.7.egg\pip\_vendor\requests\packages\urllib3\response.py", line 232, in _error_catcher
yield
File "C:\Users\user\PycharmProjects\aijoke_DRF\venv\lib\site-packages\pip-9.0.1-py3.7.egg\pip\_vendor\requests\packages\urllib3\response.py", line 314, in read
data = self._fp.read(amt)
File "C:\Users\user\PycharmProjects\aijoke_DRF\venv\lib\site-packages\pip-9.0.1-py3.7.egg\pip\_vendor\cachecontrol\filewrapper.py", line 60, in read
data = self.__fp.read(amt)
File "C:\Program Files\Python37\lib\http\client.py", line 457, in read
n = self.readinto(b)
File "C:\Program Files\Python37\lib\http\client.py", line 501, in readinto
n = self.fp.readinto(b)
File "C:\Program Files\Python37\lib\socket.py", line 589, in readinto
return self._sock.recv_into(b)
File "C:\Program Files\Python37\lib\ssl.py", line 1071, in recv_into
return self.read(nbytes, buffer)
File "C:\Program Files\Python37\lib\ssl.py", line 929, in read
return 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\user\PycharmProjects\aijoke_DRF\venv\lib\site-packages\pip-9.0.1-py3.7.egg\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\Users\user\PycharmProjects\aijoke_DRF\venv\lib\site-packages\pip-9.0.1-py3.7.egg\pip\commands\install.py", line 324, in run
requirement_set.prepare_files(finder)
File "C:\Users\user\PycharmProjects\aijoke_DRF\venv\lib\site-packages\pip-9.0.1-py3.7.egg\pip\req\req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "C:\Users\user\PycharmProjects\aijoke_DRF\venv\lib\site-packages\pip-9.0.1-py3.7.egg\pip\req\req_set.py", line 620, in _prepare_file
session=self.session, hashes=hashes)
File "C:\Users\user\PycharmProjects\aijoke_DRF\venv\lib\site-packages\pip-9.0.1-py3.7.egg\pip\download.py", line 821, in unpack_url
hashes=hashes
File "C:\Users\user\PycharmProjects\aijoke_DRF\venv\lib\site-packages\pip-9.0.1-py3.7.egg\pip\download.py", line 659, in unpack_http_url
hashes)
File "C:\Users\user\PycharmProjects\aijoke_DRF\venv\lib\site-packages\pip-9.0.1-py3.7.egg\pip\download.py", line 882, in _download_http_url
_download_url(resp, link, content_file, hashes)
File "C:\Users\user\PycharmProjects\aijoke_DRF\venv\lib\site-packages\pip-9.0.1-py3.7.egg\pip\download.py", line 603, in _download_url
hashes.check_against_chunks(downloaded_chunks)
File "C:\Users\user\PycharmProjects\aijoke_DRF\venv\lib\site-packages\pip-9.0.1-py3.7.egg\pip\utils\hashes.py", line 46, in check_against_chunks
for chunk in chunks:
File "C:\Users\user\PycharmProjects\aijoke_DRF\venv\lib\site-packages\pip-9.0.1-py3.7.egg\pip\download.py", line 571, in written_chunks
for chunk in chunks:
File "C:\Users\user\PycharmProjects\aijoke_DRF\venv\lib\site-packages\pip-9.0.1-py3.7.egg\pip\utils\ui.py", line 139, in iter
for x in it:
File "C:\Users\user\PycharmProjects\aijoke_DRF\venv\lib\site-packages\pip-9.0.1-py3.7.egg\pip\download.py", line 560, in resp_read
decode_content=False):
File "C:\Users\user\PycharmProjects\aijoke_DRF\venv\lib\site-packages\pip-9.0.1-py3.7.egg\pip\_vendor\requests\packages\urllib3\response.py", line 357, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "C:\Users\user\PycharmProjects\aijoke_DRF\venv\lib\site-packages\pip-9.0.1-py3.7.egg\pip\_vendor\requests\packages\urllib3\response.py", line 324, in read
flush_decoder = True
File "C:\Program Files\Python37\lib\contextlib.py", line 130, in __exit__
self.gen.throw(type, value, traceback)
File "C:\Users\user\PycharmProjects\aijoke_DRF\venv\lib\site-packages\pip-9.0.1-py3.7.egg\pip\_vendor\requests\packages\urllib3\response.py", line 237, in _error_catcher
raise ReadTimeoutError(self._pool, None, 'Read timed out.')
pip._vendor.requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
문제 의 원인
이 오류 가 발생 한 것 은 일반적으로 시간 초과 로 인 한 것 으로 네트워크 카드 나 다운로드 한 파일 이 비교적 크기 때 문 일 수 있 습 니 다.
해결 방안
1. 시간 초과 증가
pip --default-timeout=100 install -U django
2. 국내 소스 전환
pip install django -i http://pypi.douban.com/simple --trusted-host=pypi.douban.com