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
.
来源地址:https://blog.csdn.net/iLOVEJohnny/article/details/126466515
免责声明:
① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。
② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341