python对tesseract封装有tesserocr和pytesseract,
当pip3 install tesserocr失败可以用pyteseract安装
1。安装的是tesseract-ocr-w64-setup-v5.0.0-alpha.20201127.exe。
更多版本下载地址: https://digi.bib.uni-mannheim.de/tesseract/
2。下载完,配置环境变量,
Path:你的安装目录\Tesseract-OCR。
新建变量名:TESSDATA_PREFIX,变量值:你的安装目录\Tesseract-OCR\tessdata
3。cmd命令行tesseract -v可以查看版本
4。在命令行输入下列命令
pip install pytesseract
pip install pillow
5。cmd进Python(引用实例)
import pytesseract
from PIL import Image
image = Image.open('D://test.png')
print(pytesseract.image_to_string(image))

发表评论