已解决AttributeError: partially ini

2023-04-27  本文已影响0人  朝畫夕拾

ImportError: Microsoft Visual C++ Redistributable for Visual Studio 2019 not installed on the machin

含有ddddocr模块的项目使用pyinstaller 打包后报错 ImportError: Microsoft Visual C++ Redistributable for Visual Studio 2019 not installed on the machine.

解决方案:安装Microsoft Visual C++ Redistributable 2019

Microsoft Visual C++ Redistributable 2019x86 官方下载地址

Microsoft Visual C++ Redistributable 2019x64 官方下载地址

已解决(ddddocr模块验证码识别报错)AttributeError: partially initialized module ‘cv2’ has no attribute ‘gapi_wip_gst_GStreamerPipeline’ (most likely due to a circular import)

import  ddddocr

cr = ddddocr.DdddOcr()

with open(r"E:\Python\验证码.png", 'rb') as f:

    img_bytes = f.read()

res = ocr.classification(img_bytes)

print(res)

可以看到导包没有问题:

但是运行代码却报错了:

报错信息翻译:

属性错误:部分初始化的模块“cv2”没有属性“gap_wip_gst_GStreamerPipeline”(很可能是由于循环导入)

报错原因:

ddddocr底层调用了其他模块,却没有安装依赖的模块所以报错了,小伙伴按照下面的代码安装依赖模块即可!!!

解决方法

pip安装依赖模块opencv:

pip3  install  opencv-python install  "opencv-python-headless<4.3"  -i  https://pypi.tuna.tsinghua.edu.cn/simple/

出现版本号表明安装成功了:

安装后再次运行代码成功了:

以上是此问题报错原因的解决方法,欢迎评论区留言讨论是否能解决,如果有用欢迎点赞收藏文章谢谢支持,博主才有动力持续记录遇到的问题!!!

上一篇 下一篇

猜你喜欢

热点阅读