遇到的问题
在安装cv2时,遇到了如下报错:
(pytorch) E:\test>pip install opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', OSError(10038, '在一个非套接字上尝试了一个操作。', None, 10038, None))': /simple/opencv-python/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', OSError(10038, '在一个非套接字上尝试了一个操作。', None, 10038, None))': /simple/opencv-python/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', OSError(10038, '在一个非套接字上尝试了一个操作。', None, 10038, None))': /simple/opencv-python/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', OSError(10038, '在一个非套接字上尝试了一个操作。', None, 10038, None))': /simple/opencv-python/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', OSError(10038, '在一个非套接字上尝试了一个操作。', None, 10038, None))': /simple/opencv-python/
ERROR: Could not find a version that satisfies the requirement opencv-python (from versions: none)
ERROR: No matching distribution found for opencv-python
解决办法
将该域强制信任,增加参数 --trusted-host
。如:
pip install opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn
另外,记录国内可用的镜像源:
评论 (0)