#步骤
- 安装tesseract库 brew install tesseract
- pip安装python的tesseract接口 pip install pytesseract
- 下载中文数据集 tessdata github chi_sim.traineddata放置到tesseract安装目录下share/tessdata e.g:/usr/local/Cellar/tesseract/3.05.01/share/tessdata
#使用tesseract
import pytesseract
from PIL import Image
# open image
image = Image.open('test.jpg')
code = pytesseract.image_to_string(image, lang='chi_sim')
print(code)