报错为:AttributeError: partially initialized module 'cv2' has no attribute 'gapi_wip_gst_GStreamerPipeline' (most likely due to a circular import)

常见解决方法是替换opencv-python-headless,参考解决 Python 中 `cv2` 模块部分初始化导致的 `AttributeError`-CSDN博客

另一种可能是安装opencv-contrib-python与opencv-python不匹配,需要统一版本的opencv-python和 opencv-contrib-python

建议使用conda list查看依赖进行分析,例如我的信息是

opencv-contrib-python 4.11.0.86 pypi_0 pypi

opencv-python 4.5.4.58 pypi_0 pypi

于是进行卸载重装opencv-contrib-python

pip uninstall opencv-python

pip install opencv-contrib-python==4.5.4.58 (与你的opencv-python对应)

再运行就是正常的

Logo

加入社区!打开量化的大门,首批课程上线啦!

更多推荐