3
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.. enter image description here

enter image description here

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

1 Answers1

1
sudo dnf install tesseract

If you are using Windows than you need to install Tesseract @Bhargav gave that link. If you are using Ubuntu, Mint or something else..

You have to try

sudo apt-get install tesseract-ocr

If you are using Arch than, visit the link