【问题标题】:Import ocrmypdf in Visual Stdio Code in Python在 Python 中的 Visual Studio Code 中导入 ocrmypdf
【发布时间】:2021-09-05 17:51:29
【问题描述】:

我想导入ocrmypdf

我已经使用pip install --upgrade --user ocrmypdf安装了这个包

但是当我尝试在 VSC 中导入时:

import ocrmypdf

发现错误:

[WinError 2] The system cannot find the file specified
[WinError 2] The system cannot find the file specified
---------------------------------------------------------------------------
MissingDependencyError                    Traceback (most recent call last)
<ipython-input-9-a81f3474d7ad> in <module>
----> 1 import ocrmypdf

~\AppData\Roaming\Python\Python38\site-packages\ocrmypdf\__init__.py in <module>
      8 from pluggy import HookimplMarker as _HookimplMarker
      9 
---> 10 from ocrmypdf import helpers, hocrtransform, leptonica, pdfa, pdfinfo
     11 from ocrmypdf._concurrent import Executor
     12 from ocrmypdf._jobcontext import PageContext, PdfContext

~\AppData\Roaming\Python\Python38\site-packages\ocrmypdf\leptonica.py in <module>
     42 _libpath = find_library(libname)
     43 if not _libpath:
---> 44     raise MissingDependencyError(
     45         """
     46         ---------------------------------------------------------------------

MissingDependencyError: 
        ---------------------------------------------------------------------
        This error normally occurs when ocrmypdf can't find the Leptonica
        library, which is usually installed with Tesseract OCR. It could be that
        Tesseract is not installed properly, we can't find the installation
        on your system PATH environment variable.

        The library we are looking for is usually called:
            liblept-5.dll   (Windows)
            liblept*.dylib  (macOS)
            liblept*.so     (Linux/BSD)

        Please review our installation procedures to find a solution:
            https://ocrmypdf.readthedocs.io/en/latest/installation.html
        ---------------------------------------------------------------------
        

【问题讨论】:

  • 安装 Tesseract OCR 并将 tesseract.exe 添加到 PATH 后,您的问题解决了吗?

标签: python visual-studio-code ocrmypdf


【解决方案1】:

错误日志指出缺少某些依赖项,这意味着缺少 ocrmypdf 正在使用的某些模块。最有可能的是,它需要 teseract OCR。尝试安装它,它可能会工作。甚至模块的documentation 也声明模块需要tesseract 才能正常工作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-05
    • 2018-11-17
    相关资源
    最近更新 更多