import pytesseract
from PIL import Image
img = Image.open('image1.jpg')
result = pytesseract.image_to_string(img)
print(result)
My question is may similar to this and this. But, there's no helpful answer for me...
Error :
Traceback (most recent call last):
File "/home/istiak/PycharmProjects/image-to-text/venv/lib64/python3.9/site-packages/pytesseract/pytesseract.py", line 255, in run_tesseract proc = subprocess.Popen(cmd_args, **subprocess_args()) File "/usr/lib64/python3.9/subprocess.py", line 951, in init self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib64/python3.9/subprocess.py", line 1823, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'tesseract'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/istiak/PycharmProjects/image-to-text/main.py", line 6, in result = pytesseract.image_to_string(img) File "/home/istiak/PycharmProjects/image-to-text/venv/lib64/python3.9/site-packages/pytesseract/pytesseract.py", line 409, in image_to_string return { File "/home/istiak/PycharmProjects/image-to-text/venv/lib64/python3.9/site-packages/pytesseract/pytesseract.py", line 412, in Output.STRING: lambda: run_and_get_output(*args), File "/home/istiak/PycharmProjects/image-to-text/venv/lib64/python3.9/site-packages/pytesseract/pytesseract.py", line 287, in run_and_get_output run_tesseract(**kwargs) File "/home/istiak/PycharmProjects/image-to-text/venv/lib64/python3.9/site-packages/pytesseract/pytesseract.py", line 259, in run_tesseract raise TesseractNotFoundError() pytesseract.pytesseract.TesseractNotFoundError: tesseract is not installed or it's not in your PATH. See README file for more information.
But, I have pytesseract right there..
I found this helpful for him. But, I am using Linux Fedora... Is there something just like this in Linux?
I tried to install tesseract-ocr
link......
sudo snap install tesseract-ocr
sudo dnf install tesseract-ocr
Error : Unable to find a match: tesseract-ocr