我正在将TesseractError:(2,'用法:pytesseract [-l lang] input_file')错误,在Google Colab中将图像转换为文本时出错

问题描述 投票:2回答:1

下面是我的代码

im=Image.open("/root/ppm_to_jpg/6e196d3b-adec-45ab-b036-5833f96f1bc0-2.jpg")
pytesseract.pytesseract.tesseract_cmd = r'/usr/local/bin/pytesseract'
text=pytesseract.image_to_string(im,lang="eng")
print (text)

我以TesseractError错误出现:(2,'用法:pytesseract [-l lang] input_file')即使我已经设置pytesseract.pytesseract.tesseract_cmd = r'/ usr / local / bin / pytesseract

谁能建议我该怎么办

python machine-learning computer-vision ocr
1个回答
0
投票

!sudo apt install tesseract-ocr

以上安装了pytesseract所需的依赖项。这非常重要,尤其是!没有它们,您将无法直接安装到基础操作系统。

!pip install pytesseract

这将安装Python绑定。

希望这会有所帮助。

© www.soinside.com 2019 - 2024. All rights reserved.