AttributeError: partially initialized module ‘cv2‘ has no attribute ‘gapi_wip_gst_GStreamerPipeline‘

关于opencv报’gapi_wip_gst_GStreamerPipeline’ 错误
说明

在使用opencv时报
AttributeError: partially initialized module ‘cv2’ has no attribute ‘gapi_wip_gst_GStreamerPipeline’ (most likely due to a circular import)


原因

在更新安装其他库的时候把opencv更新到了最新的版本


解决方案
降低opencv版本

#查看opecv版本
pip install opencv-python==
ERROR: Could not find a version that satisfies the requirement opencv-python== 
(from versions: 3.4.0.14, 3.4.8.29, 3.4.9.31, 3.4.9.33, 3.4.10.35, 3.4.10.37, 
3.4.11.39, 3.4.11.41, 3.4.11.43, 3.4.11.45, 3.4.13.47, 3.4.14.51, 3.4.14.53, 
3.4.15.55, 3.4.16.57, 3.4.16.59, 3.4.17.61, 3.4.17.63, 3.4.18.65, 4.1.2.30, 4.2.0.32,
 4.2.0.34, 4.3.0.36, 4.3.0.38, 4.4.0.40, 4.4.0.42, 4.4.0.44, 4.4.0.46, 4.5.1.48, 
 4.5.2.52, 4.5.2.54, 4.5.3.56, 4.5.4.58, 4.5.4.60, 4.5.5.62, 4.5.5.64, 4.6.0.66, 
 4.7.0.68, 4.7.0.72)
#然后安装低版本的opencv,常用稳定版本4.5
pip install opencv-python==4.5.1.48