首先参考这个:安装opencv遇到的问题ERROR: Could not find a version that satisfies the requirement opencv (from versions: n-CSDN博客
如果尝试上面的方法也不行的话:
最好的方法就是从网上下载符合自己的操作系统和python版本的opencv-python包和opencv-contrib-python包,然后上传至服务器,再使用如下代码进行安装。
pip install 下载的安装包的名称
参考博客:离线安装opencv
opencv-python 安装包网址:
https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/opencv-python/
opencv-contrib-python 安装包网址:https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/opencv-contrib-python/