AttributeError: module 'ocrmypdf' has no attribute 'ocr'

AttributeError: module 'ocrmypdf' has no attribute 'ocr'

我正在使用 ocrmypdf 库将扫描的 pdf 转换为可搜索的 pdf,但出现此错误。

这是我目前的代码运行

import ocrmypdf
ocrmypdf.ocr('/content/drive/MyDrive/Dataset 2020/OCR/1081975.pdf', 'output.pdf')

错误:-

AttributeError: module 'ocrmypdf' has no attribute 'ocr'

我在 google collab 上使用以下命令安装了这个库,它工作正常:-

  1. apt install ocrmypdf

  2. pip3 install git+https://github.com/jbarlow83/OCRmyPDF.git

  3. pip3 install pluggy