已解决-‘cv2’ has no attribute ‘gapi_wip_gst_GStreamerPipeline’

出现错误:
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” --user

出现错误

resnet = timm.create_model('convnext_small',num_classes=1000,pretrained=True)

RuntimeError: [enforce fail at …\caffe2\serialize\inline_container.cc:145] . PytorchStreamReader failed reading zip archive: failed finding central directory

解决方法:
原因是下载过程中被中断,导致模型文件不完整,可重新从timm库中下载另一个模型,找到模型存放位置,删除损坏的模型,重新执行原代码
在这里插入图片描述

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
"partially initialized module 'cv2' has no attribute 'gapi_wip_gst_GStreamerPipeline'" 这个错误提示通常出现在使用OpenCV库中的cv2模块时。这个错误通常是由OpenCV版本不兼容或者安装问题引起的。 出现这个错误的原因可能有几个可能性: 1. OpenCV版本不兼容:这个错误可能是由于你使用的OpenCV版本不支持 'gapi_wip_gst_GStreamerPipeline' 属性所引起的。你可以尝试升级或更换OpenCV版本来解决这个问题。 2. 安装问题:这个错误也可能是由于OpenCV没有正确安装或安装过程中出现了问题所导致的。你可以尝试重新安装OpenCV,确保按照官方文档提供的安装步骤进行操作。 3. 环境配置问题:有时候,这个错误也可能是由于环境配置问题引起的。你可以尝试在安装前检查和更新你的Python环境,并确保你的依赖包和库都正确安装和配置。 综上所述,如果你遇到了"partially initialized module 'cv2' has no attribute 'gapi_wip_gst_GStreamerPipeline'"错误,建议你先检查OpenCV版本是否支持该属性,然后重新安装OpenCV或者检查环境配置。希望这些方法能够帮助你解决问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [已解决【partially initialized module ‘cv2‘ has no attribute ‘gapi_wip_gst_GStreamerPipeline‘】](https://blog.csdn.net/weixin_52025885/article/details/127590114)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* *3* [cv2‘ has no attribute ‘gapi_wip_gst_GStreamerPipeline‘错误解决方法](https://blog.csdn.net/jacke121/article/details/126666893)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值