【问题标题】:pytesseract.pytesseract.TesseractNotFoundError: tesseract is not installed or it's not in your PATH. See README file for more informationpytesseract.pytesseract.TesseractNotFoundError: tesseract 未安装或不在您的 PATH 中。有关更多信息,请参阅 README 文件
【发布时间】:2021-03-16 16:17:15
【问题描述】:
import pytesseract
from PIL import Image

img = Image.open('image1.jpg')

result = pytesseract.image_to_string(img)

print(result)

我的问题可能类似于thisthis。但是,没有对我有用的答案...

错误:

Traceback(最近一次调用最后一次):

文件“/home/istiak/PycharmProjects/image-to-text/venv/lib64/python3.9/site-packages/pytesseract/pytesseract.py”,第 255 行,在 run_tesseract proc = subprocess.Popen(cmd_args, **subprocess_args()) init 中的文件“/usr/lib64/python3.9/subprocess.py”,第 951 行 self._execute_child(args, 可执行文件, preexec_fn, close_fds, _execute_child 中的文件“/usr/lib64/python3.9/subprocess.py”,第 1823 行 raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError:[Errno 2] 没有这样的文件或目录:'tesseract'

在处理上述异常的过程中,又发生了一个异常:

Traceback(最近一次调用最后一次): 文件“/home/istiak/PycharmProjects/image-to-text/main.py”,第 6 行,在 结果 = pytesseract.image_to_string(img) 文件“/home/istiak/PycharmProjects/image-to-text/venv/lib64/python3.9/site-packages/pytesseract/pytesseract.py”,第 409 行,位于 image_to_string 返回 { 文件“/home/istiak/PycharmProjects/image-to-text/venv/lib64/python3.9/site-packages/pytesseract/pytesseract.py”,第 412 行,在 Output.STRING: lambda: run_and_get_output(*args), 文件“/home/istiak/PycharmProjects/image-to-text/venv/lib64/python3.9/site-packages/pytesseract/pytesseract.py”,第 287 行,在 run_and_get_output run_tesseract(**kwargs) 文件“/home/istiak/PycharmProjects/image-to-text/venv/lib64/python3.9/site-packages/pytesseract/pytesseract.py”,第 259 行,在 run_tesseract 引发 TesseractNotFoundError() pytesseract.pytesseract.TesseractNotFoundError: tesseract 未安装或不在您的 PATH 中。有关详细信息,请参阅 README 文件。

但是,我那里有 pytesseract..

我发现thishim 很有帮助。但是,我正在使用 Linux Fedora... Linux 中是否有类似的东西?

我尝试安装tesseract-ocrlink......

sudo snap install tesseract-ocr
sudo dnf install tesseract-ocr

错误:无法找到匹配项:tesseract-ocr

【问题讨论】:

    标签: python error-handling python-tesseract


    【解决方案1】:
    sudo dnf install tesseract
    

    如果您使用的是 Windows,则需要安装 Tesseract @Bhargav 提供了该链接。如果您使用的是 Ubuntu、Mint 或其他软件..

    你必须尝试

    sudo apt-get install tesseract-ocr
    

    如果您使用的是 Arch,请访问 link

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-01-11
      • 2020-08-26
      • 1970-01-01
      • 2014-03-25
      • 2017-09-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多