赞
踩
环境:
pycharm
python3.7
tesseract-ocr(下载地址https://digi.bib.uni-mannheim.de/tesseract/tesseract-ocr-setup-4.00.00dev.exe)
1、导入以下两个package
from PIL import Image import pytesseract
2、进入project***\venv\Lib\site-packages\pytesseract目录,修改pytesseract.py配置,添加tesseract路径
3、代码
# -*- coding: utf-8 -*- from PIL import Image import pytesseract text=pytesseract.image_to_string(Image.open('d:/m2.png')) print(text)
按照前序步骤配置,此时就可以读取图片上的数据了。
如本地要使用tesseract-ocr,则需要设置环境变量,电脑-属性-高级-环境变量
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。