pip install pytesseract



报错:tesseract is not installed or it's not in your path

识别中文需要新的字库

图片:English.png

Python 进行 OCR识别 -- pytesseract库 Python 第2张

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

图片:Chinese.png

Python 进行 OCR识别 -- pytesseract库 Python 第3张

识别

import pytesseract
from PIL import Image

im_en = Image.open('English.png')
im_ch = Image.open('Chinese.png')

print('========识别字母========')
print(pytesseract.image_to_string(im_en), '\n\n')

print('========识别中文========')
print(pytesseract.image_to_string(im_ch, lang='chi_sim'))


结果

Python 进行 OCR识别 -- pytesseract库 Python 第4张




扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄