以ipython为例
C:Usersshenyf>pip install ipythonWARNING: Ignoring invalid distribution -ip (d:python37libsite-packages)WARNING: Ignoring invalid distribution -ip (d:python37libsite-packages)Collecting ipython Using cached ipython-7.31.1-py3-none-any.whl (792 kB)Collecting backcall WARNING: Retrying (Retry(total=4, 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/4c/1c/ff6546b6c12603d8dd1070aa3c3d273ad4c07f5771689a7b69a550e8c951/backcall-0.2.0-py2.py3-none-any.whl Downloading backcall-0.2.0-py2.py3-none-any.whl (11 kB)Collecting jedi>=0.16 Downloading jedi-0.18.1-py2.py3-none-any.whl (1.6 MB) |████ | 204 kB 13 kB/s eta 0:01:42ERROR: Exception:Traceback (most recent call last): File "D:Python37libsite-packagespip_vendorurllib3response.py", line 438, in _error_catcher yield File "D:Python37libsite-packagespip_vendorurllib3response.py", line 519, in read data = self._fp.read(amt) if not fp_closed else b"" File "D:Python37libsite-packagespip_vendorcachecontrolfilewrapper.py", line 62, in read data = self.__fp.read(amt) File "D:Python37libhttpclient.py", line 447, in read n = self.readinto(b) File "D:Python37libhttpclient.py", line 491, in readinto n = self.fp.readinto(b) File "D:Python37libsocket.py", line 589, in readinto return self._sock.recv_into(b) File "D:Python37libssl.py", line 1052, in recv_into return self.read(nbytes, buffer) File "D:Python37libssl.py", line 911, in read return 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:Python37libsite-packagespip_internalclibase_command.py", line 173, in _main status = self.run(options, args) File "D:Python37libsite-packagespip_internalclireq_command.py", line 203, in wrapper return func(self, options, args) File "D:Python37libsite-packagespip_internalcommandsinstall.py", line 316, in run reqs, check_supported_wheels=not options.target_dir File "D:Python37libsite-packagespip_internalresolutionresolvelibresolver.py", line 95, in resolve collected.requirements, max_rounds=try_to_avoid_resolution_too_deep File "D:Python37libsite-packagespip_vendorresolvelibresolvers.py", line 472, in resolve state = resolution.resolve(requirements, max_rounds=max_rounds) File "D:Python37libsite-packagespip_vendorresolvelibresolvers.py", line 366, in resolve failure_causes = self._attempt_to_pin_criterion(name) File "D:Python37libsite-packagespip_vendorresolvelibresolvers.py", line 212, in _attempt_to_pin_criterion criteria = self._get_updated_criteria(candidate) File "D:Python37libsite-packagespip_vendorresolvelibresolvers.py", line 203, in _get_updated_criteria self._add_to_criteria(criteria, requirement, parent=candidate) File "D:Python37libsite-packagespip_vendorresolvelibresolvers.py", line 172, in _add_to_criteria if not criterion.candidates: File "D:Python37libsite-packagespip_vendorresolvelibstructs.py", line 151, in __bool__ return bool(self._sequence) File "D:Python37libsite-packagespip_internalresolutionresolvelibfound_candidates.py", line 140, in __bool__ return any(self) File "D:Python37libsite-packagespip_internalresolutionresolvelibfound_candidates.py", line 128, in
解决办法:延长超时时间
pip --default-timeout=10000 install -U ipython