Package | 解决 module ‘cv2‘ has no attribute ‘gapi_wip_gst_GStreamerPipeline‘

.

问题背景

由于这个问题出现了两回,决定记录一下。实验背景是使用opencv python库进行数据预处理,遇到报错信息如下:

import cv2
File “/opt/conda/lib/python3.8/site-packages/cv2/init.py”, line 181, in
bootstrap()
File “/opt/conda/lib/python3.8/site-packages/cv2/init.py”, line 175, in bootstrap
if __load_extra_py_code_for_module(“cv2”, submodule, DEBUG):
File “/opt/conda/lib/python3.8/site-packages/cv2/init.py”, line 28, in __load_extra_py_code_for_module
py_module = importlib.import_module(module_name)
File “/opt/conda/lib/python3.8/importlib/init.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “/opt/conda/lib/python3.8/site-packages/cv2/gapi/init.py”, line 290, in
cv.gapi.wip.GStreamerPipeline = cv.gapi_wip_gst_GStreamerPipeline
AttributeError: partially initialized module ‘cv2’ has no attribute ‘gapi_wip_gst_GStreamerPipeline’ (most likely due to a circular import)

.

解决方案

检索的方法里有几个不太适用,尝试了几个后亲测这个方法有效:

pip install opencv-python install "opencv-python-headless<4.3"

参考原博文链接:https://blog.csdn.net/qq_40761320/article/details/125687320?spm=1001.2014.3001.5501

.

你可能感兴趣的:(Package,python,opencv,开发语言)