我一直在遵循 docTR 的 git 安装指南,并且可以在 google colab 中成功安装它。当我在本地 PyCharm 中进行相同的尝试时,我总是收到错误:
ModuleNotFoundError:没有名为“doctr.io”的模块; “doctr”不是一个包
我用以下方法检索它:
从 doctr.io 导入文档文件 从 doctr.models 导入 ocr_predictor
我在新的 anaconda env 和 venv 中尝试过,都抛出相同的错误。我尝试了tensorflow pip install 以及git clone。总是“ModuleNotFoundError”
以下对我有用:
! pip install python-doctr tf2onnx
from doctr.io import DocumentFile
from doctr.models import ocr_predictor
我使用的是 TPU,但我也仅使用 CPU 进行过测试。