python如何识别中英文
发布时间:2025-02-18 22:00:44

python识别中英文的方法:
1、使用“pip install pytesseract命令下载并安装ocr库
pipinstallpytesseract
2、下载ocr语言模型,放入ocr库所在文件下

3、编写翻译句子,识别图片中的中文
fromPILimportImage
importpytesseract
resDict=pytesseract.image_to_boxes(Image.open('images/example3.png'),)
print(resDict)识别结果:

原图:

更多Python知识,请关注:Python自学网!!
下一篇 python如何调用函数中的数组
