I want to extract text from the following image using Python
:
I tried with below codes but it's throwing an error:
import pytesseract
from PIL import Image
img=Image.open(r'gif file path')
pytesseract.pytesseract.tesseract_cmd = 'C:/Program Files (x86)/Tesseract-
OCR/tesseract'
r=pytesseract.image_to_string(img)
print(r)
And
from PIL import Image
from pytesseract import image_to_string
img=Image.open('gif file path')
text=image_to_string(img)
print(text)
Error:
TesseractNotFoundError.
Please help any way to get the text using Python
.
Note: pytesseract
is already installed.
One thing is to have the library pytesseract installed, and other one is to have Tesseract installed.
If you are in Linux try:
sudo apt install libtesseract-dev tesseract-ocr
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.