linux安装opencv-python提示代理有问题

pip install opencv-python
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Your proxy appears to only use HTTP and not HTTPS, try changing your proxy URL to be HTTP. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#https-proxy-error-http-proxy', SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1002)')))': /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   

意思是说代理有问题,只能用HTTP,不能用HTTPS,需要把代理改成http,可以根据提示访问连接查看解决方法,也可以按照下面方法:

先看下http和https的代理:

echo $http_proxy

输出:http://10.7.69.105:808

echo $https_proxy

输出:https://10.7.69.105:808

问题就在这里,https_proxy是https的,输入下面命令给他改成http

export https_proxy=http://10.7.69.105:808

然后重新下载,就OK了

pip install opencv-python
Collecting opencv-python
  Downloading opencv_python-4.9.0.80-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (62.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.2/62.2 MB 134.9 kB/s eta 0:00:00
Requirement already satisfied: numpy>=1.21.2 in ./anaconda3/lib/python3.11/site-packages (from opencv-python) (1.24.3)
Installing collected packages: opencv-python
Successfully installed opencv-python-4.9.0.80