使用anaconda prompt安装opencv时,显示好多错误,它说read timed out,请问这有什么方法解决吗?
错误代码如下:
已解决
方法是更换镜像源,更换为中科大的,参考视频如下:
https://www.bilibili.com/video/BV1oi4y1G7u4/
```python
(base) C:\Users\Administrator>pip install opencv-python
Collecting opencv-python
Downloading opencv_python-4.9.0.80-cp37-abi3-win_amd64.whl.metadata (20 kB)
Requirement already satisfied: numpy>=1.21.2 in d:\anaconda3\lib\site-packages (from opencv-python) (1.26.4)
Downloading opencv_python-4.9.0.80-cp37-abi3-win_amd64.whl (38.6 MB)
---------------------------------------- 0.1/38.6 MB 11.7 kB/s eta 0:55:03
ERROR: Exception:
Traceback (most recent call last):
File "D:\anaconda3\Lib\site-packages\pip\_vendor\urllib3\response.py", line 438, in _error_catcher
yield
File "D:\anaconda3\Lib\site-packages\pip\_vendor\urllib3\response.py", line 561, in read
data = self._fp_read(amt) if not fp_closed else b""
^^^^^^^^^^^^^^^^^^
File "D:\anaconda3\Lib\site-packages\pip\_vendor\urllib3\response.py", line 527, in _fp_read
return self._fp.read(amt) if amt is not None else self._fp.read()
^^^^^^^^^^^^^^^^^^
File "D:\anaconda3\Lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 98, in read
data: bytes = self.__fp.read(amt)
^^^^^^^^^^^^^^^^^^^
File "D:\anaconda3\Lib\http\client.py", line 473, in read
s = self.fp.read(amt)
^^^^^^^^^^^^^^^^^
File "D:\anaconda3\Lib\socket.py", line 706, in readinto
return self._sock.recv_into(b)
^^^^^^^^^^^^^^^^^^^^^^^
File "D:\anaconda3\Lib\ssl.py", line 1315, in recv_into
return self.read(nbytes, buffer)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\anaconda3\Lib\ssl.py", line 1167, in read
return self._sslobj.read(len, buffer)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TimeoutError: The read operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\anaconda3\Lib\site-packages\pip\_internal\cli\base_command.py", line 180, in exc_logging_wrapper
status = run_func(*args)
^^^^^^^^^^^^^^^
File "D:\anaconda3\Lib\site-packages\pip\_internal\cli\req_command.py", line 245, in wrapper
return func(self, options, args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\anaconda3\Lib\site-packages\pip\_internal\commands\install.py", line 377, in run
requirement_set = resolver.resolve(
^^^^^^^^^^^^^^^^^
File "D:\anaconda3\Lib\site-packages\pip\_internal\resolution\resolvelib\resolver.py", line 179, in resolve
self.factory.preparer.prepare_linked_requirements_more(reqs)
File "D:\anaconda3\Lib\site-packages\pip\_internal\operations\prepare.py", line 552, in prepare_linked_requirements_more
self._complete_partial_requirements(
File "D:\anaconda3\Lib\site-packages\pip\_internal\operations\prepare.py", line 467, in _complete_partial_requirements
for link, (filepath, _) in batch_download:
File "D:\anaconda3\Lib\site-packages\pip\_internal\network\download.py", line 183, in __call__
for chunk in chunks:
File "D:\anaconda3\Lib\site-packages\pip\_internal\cli\progress_bars.py", line 53, in _rich_progress_bar
for chunk in iterable:
File "D:\anaconda3\Lib\site-packages\pip\_internal\network\utils.py", line 63, in response_chunks
for chunk in response.raw.stream(
File "D:\anaconda3\Lib\site-packages\pip\_vendor\urllib3\response.py", line 622, in stream
data = self.read(amt=amt, decode_content=decode_content)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\anaconda3\Lib\site-packages\pip\_vendor\urllib3\response.py", line 560, in read
with self._error_catcher():
File "D:\anaconda3\Lib\contextlib.py", line 158, in __exit__
self.gen.throw(typ, value, traceback)
File "D:\anaconda3\Lib\site-packages\pip\_vendor\urllib3\response.py", line 443, 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.
```