.
问题背景
由于这个问题出现了两回,决定记录一下。实验背景是使用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)
”
.
解决方案
检索的方法里有几个不太适用,尝试了几个后亲测这个方法有效:文章来源:https://www.toymoban.com/news/detail-806690.html
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://www.toymoban.com/news/detail-806690.html
.
到了这里,关于Package | 解决 module ‘cv2‘ has no attribute ‘gapi_wip_gst_GStreamerPipeline‘的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!