OSError:在环境中找不到 Tesseract。检查变量和路径

问题描述 投票:0回答:1

我正在尝试使用 img2table 读取扫描图像中的数据。我从一个基本示例开始,但我不断收到 OSError: Tesseract not found inenvironment 。检查变量和路径。

这是我的代码:

from img2table.document import Image
from img2table.ocr import TesseractOCR

img = Image("mark sheet.jpg")
tesseract = TesseractOCR()

# Extract tables with Tesseract and PaddleOCR
tables = img.extract_tables(ocr=tesseract, borderless_tables=True)

tables[0].df

错误如下: 文件“C:\Users\PC\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\img2table\ocr esseract.py”,第 56 行,位于 init 引发环境错误(“在环境中找不到Tesseract。检查变量和路径”)

我安装的库似乎在某些环境中找不到任何东西。 我不知道如何继续。

请帮忙。

python python-import python-tesseract
1个回答
0
投票

您收到该错误是因为 Python 在运行时路径中找不到 Tesseract 可执行文件。 Tesseract 是一个外部库,位于

pytesseract
python 库之外。除了使用
pip
安装 pytesseract 之外,您还需要下载可执行库
tesseract
并将其添加到您的
PATH
以便 Python 可以找到它。

本指南似乎很好地概述了整个过程:https://ironsoftware.com/csharp/ocr/blog/ocr-tools/tesseract-ocr-windows/

以下是官方安装文档:https://tesseract-ocr.github.io/tessdoc/Installation.html

© www.soinside.com 2019 - 2024. All rights reserved.