【问题标题】:Why aren't Tesseract and GhostScript recognized as commands?为什么无法将 Tesseract 和 GhostScript 识别为命令?
【发布时间】:2019-09-15 18:49:01
【问题描述】:

我有大量无法 OCR 的 PDF,因为它们每个都有一小部分可呈现的文本。

我正在尝试将它们全部转换为 TIFF,以便我可以转换回来并运行 OCR,但我在调用我希望完成这项工作的程序时遇到了问题。我安装它们没有问题,但由于某种原因,我不断收到错误消息,提示相关命令不存在:

c:\Program Files\Python37\Lib\site-packages>pip install tesseract
Requirement already satisfied: tesseract in c:\program files\python37\lib\site-packages (0.1.3)

c:\Program Files\Python37\Lib\site-packages>tesseract --version
'tesseract' is not recognized as an internal or external command,
operable program or batch file.

c:\Program Files\Python37\Lib\site-packages>pip install ghostscript
Requirement already satisfied: ghostscript in c:\program files\python37\lib\site-packages (0.6)
Requirement already satisfied: setuptools in c:\program files\python37\lib\site-packages (from ghostscript) (40.8.0)

c:\Program Files\Python37\Lib\site-packages>gs --version
'gs' is not recognized as an internal or external command,
operable program or batch file.

c:\Program Files\Python37\Lib\site-packages>gswin32c --version
'gswin32c' is not recognized as an internal or external command,
operable program or batch file.

任何想法我做错了什么?

如果您有更好的方法来执行整个任务,则可以加分。

【问题讨论】:

    标签: command-line tesseract ghostscript


    【解决方案1】:

    我注意到您使用的是 Windows,我猜您没有将 Ghostscript 安装目录添加到 $PATH 环境变量中,因此 Windows 不知道在哪里查找可执行文件。

    可能 Python 可以使用来自 python37\lib\site-packages 目录的 Ghostscript 可执行文件,但 Windows 不会知道这一点,除非它被告知要查看那里。它可能是一个子目录,除非 Python 包安装程序使用的不是普通的 Ghostscript Windows 安装程序。

    请注意,在 Windows 上,二进制文件不称为“gs”;它将是 gswin32、gswin64、gswin32c 或 gswin64c,具体取决于您安装的是 32 位还是 64 位版本的 Ghostscript,以及您想要命令行 (c) 版本还是窗口版本。

    可能最简单的找到它的方法是查看指定的 Python 文件夹并查看。

    【讨论】:

    猜你喜欢
    • 2011-02-14
    • 2020-08-15
    • 1970-01-01
    • 1970-01-01
    • 2021-05-29
    • 1970-01-01
    • 2020-12-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多