下面是我的代码
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, 'Usage: pytesseract [-l lang] input_file') 即使我已经设置了 pytesseract.pytesseract.tesseract_cmd = r'/usr/local/bin/pytesseract
谁能建议我该怎么做
最佳答案
!sudo apt install tesseract-ocr
上面安装了 pytesseract 所需的依赖项。这非常重要,尤其是 !没有它,您将无法直接安装到底层操作系统。
!pip install pytesseract
这将安装 Python 绑定(bind)。
希望这对您有所帮助。
关于python - 我在 google colab 中将图像转换为文本时出现 TesseractError : (2, 'Usage: pytesseract [-l lang] input_file' ) 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60718205/