一、AttributeError: module ‘cv2’ has no attribute ‘gapi_wip_gst_GStreamerPipeline’
法一:opencv-contrib-python
与opencv-python
只留一个就可以了(建议保留前者)
注:对写明了同时需要安装
opencv-contrib-python
与opencv-python
的项目来说没用
法二:把opencv-python更新到最新版本pip3 install --user --upgrade opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple
注意,二者的版本必须一致不然还是会报这个错
比如:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple opencv-python==3.4.1.15
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple opencv-contrib-python==
3.4.1.15`
然后用pip list
查自己所有的包,看看二者是不是同一个版本了
二、Opencv-contrib-python与opencv-python不同之处
在pypi中解释到:
- run
pip install opencv-python
if you need only main modules - run
pip install opencv-contrib-python
if you need both main and contrib modules (check extra modules listing from OpenCV documentation)
opencv-python 是只包含了主要模块的包,opencv-contrib-python包含了主要模块以及扩展模块,扩展模块主要是包含了一些带专利的收费算法(如shift特征检测)以及一些在测试的新的算法(稳定后会合并到主要模块)。