Issue
I have downloaded pytesseract from here, (tesseract-ocr-setup-3.05.00dev-205-ge205c59.exe) it was executed and saved on Program Files (x86).
Then I tried to run the following code on Spyder, but I got error ModuleNotFoundError: No module named 'pytesseract'. I am not sure what else should I do to use pytesseract?
import cv2
import pytesseract
IMG_DIR = 'Pictures/'
image = cv2.imread(IMG_DIR + 'aurebesh.jpg')
Solution
You downloaded only tesseract
(C/C++ program), not pytesseract
(Python module).
pytesseract
is Python module which uses tesseract
to work.
pytesseract
is so called wrapper
on tesseract
.
You have to run in console:
pip install pytesseract
to install Python module.
At this moment you can only run tesseract.exe
(C/C++ program) in console/terminal - ie.
tesseract.exe --help
tesseract.exe image.jpg output
Or you can run it in Python with
subprocess.run("tesseract.exe --help", shell=True)
subprocess.run("tesseract.exe image.jpg output", shell=True)
but they may need to use /full/path/to/tesseract.exe
and /full/path/to/image.jpg
BTW:
pytesseract
also uses subprocess.run("/full/path/to/tesseract.exe ...")
to execute code but it has functions which make it all much simpler.
Answered By - furas
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.