python3.7 安装opencv报错 ERROR:Exception:Traceback(most recent call last)...

pip安装opencv-python模块,报错:

ERROR: Exception:
Traceback (most recent call last):
  File "d:\program files (x86)\python\lib\site-packages\pip\_vendor\urllib3\response.py", line 425, in _error_catcher
    yield
  File "d:\program files (x86)\python\lib\site-packages\pip\_vendor\urllib3\response.py", line 507, in read
    data = self._fp.read(amt) if not fp_closed else b""
  File "d:\program files (x86)\python\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 62, in read
    data = self.__fp.read(amt)
  File "d:\program files (x86)\python\lib\http\client.py", line 447, in read
    n = self.readinto(b)
  File "d:\program files (x86)\python\lib\http\client.py", line 491, in readinto
    n = self.fp.readinto(b)
  File "d:\program files (x86)\python\lib\socket.py", line 589, in readinto
    return self._sock.recv_into(b)
  File "d:\program files (x86)\python\lib\ssl.py", line 1052, in recv_into
    return self.read(nbytes, buffer)
  File "d:\program files (x86)\python\lib\ssl.py", line 911, in read
    return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

解决办法:采用国内镜像下载模块
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple opencv-python
我这里使用的是清华大学的镜像,如果安装中途还是报错,多执行几次该命令,直到成功

你可能感兴趣的:(python)