1.在终端首先切换到自己的anaconda虚拟环境中:
conda activate python37
2.在python版本opencv中找到自己想要安装的opencv版本,在版本号下面会有相对应的安装命令:
#我要安装的opencv版本为4.4.0,则安装命令为:
pip install opencv-python==4.4.0.46
3.等待安装完毕后,进入python解释器执行下方语句来验证是否安装成功:
Python 3.7.12 | packaged by conda-forge | (default, Oct 26 2021, 06:08:21)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> print(cv2.__version__)
4.4.0 #有版本号输出则表示安装成功