阅读:62
在安装opevncv时会出现ImportError: No module named cv2 的错误,找不到cv2的包。 这时候安装扩展包即可:
打开cmd输入:
pip install opencv-python
如果在运行后又出现报错:
Requirement already satisfied: opencv-python in ./.local/lib/python3.6/site-packages (4.2.0.34)
Requirement already satisfied: numpy>=1.11.3 in ./anaconda3/lib/python3.6/site-packages (from opencv-python) (1.13.3)
我想按opencv-python,怎么也安装不上,原来是它默认路径已经不变了,不是在我现在的虚拟环境里,所以,需要指定路径:
pip install --target=/home/xxxx/anaconda3/envs/huayan/lib/python3.6/site-packages opencv-python==4.2.0.34 -i https://pypi.doubanio.com/simple
后面的-i xxx是指定下载源。
最后打开pycharm,进行环境配置,在pycharm中安装上opencv: