我试图在python中使用pytesseract但总是最终得到错误:
"TesseractNotFoundError:没有安装tesseract,或者它不在你的路径中"
pytesseract和tesseract安装在系统中.我是python的新手,所以如果有人可以帮助我,我将非常感激
我正在尝试在 Google Colab 中运行 Tesseract:
!sudo apt install tesseract-ocr
!pip install pytesseract
import pytesseract
import shutil
import os
import random
try:
from PIL import Image
except ImportError:
import Image
from google.colab import files
uploaded = files.upload()
extractedInformation = pytesseract.image_to_string(Image.open('aaa.png'))
print(extractedInformation)
Run Code Online (Sandbox Code Playgroud)
我尝试在我正在上传的图像('aaa.png')上运行,但它运行此错误:
TesseractError: (2, 'Usage: pytesseract [-l lang] input_file')
Run Code Online (Sandbox Code Playgroud)
从几乎相同(仍未解决)的帖子中搜索,我尝试了以下代码,但仍然无法正常工作:
pytesseract.pytesseract.tesseract_cmd = (
r'/usr/local/bin/tesseract'
)
Run Code Online (Sandbox Code Playgroud)
我尝试访问 pytesseract 文件夹,但运行此错误:
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.6/dist-packages/pytesseract/pytesseract.py'
Run Code Online (Sandbox Code Playgroud)