下载链接:https://digi.bib.uni-mannheim.de/tesseract/
如下选择最新的版本,这里我选择tesseract-ocr-w64-setup-5.3.0.20221222.exe
有如下python模块操作tesseract
pyocr
国内源:pip install -i https://pypi.mirrors.ustc.edu.cn/simple/ pyocr (亲测可用)
import pyocr
import pyocr.builders
# 初始化
tools = pyocr.get_available_tools()
# 判断tools列表中是否为空,为空则初始化失败
if len(tools) == 0:
print("No OCR tool found")
sys.exit(1)
报错:No OCR tool found
可能原因:
PATH中是否有tesseract?
pytesseract
from pytesseract import pytesseract
# 定义tesseract.exe的路径
path_to_tesseract = r"C:\Program Files\Tesseract-OCR\tesseract.exe"
# Providing the tesseract executable
# location to pytesseract library
pytesseract.tesseract_cmd = path_to_tesseract
如果你有其他任何疑问,可以参考此链接:https://openpaper.work/download