0

so i am a beginner in programming. i am trying to convert a jpeg file to atext file but not able to do so.i am getting an error

try:
    from PIL import Image
except ImportError:
    import Image
import pytesseract
print(pytesseract.image_to_string(Image.open('A_1.jpg')))

I went through the documentation and found why the error is there and a solution to it:

'If you don't have tesseract executable in your PATH, include the following:
pytesseract.pytesseract.tesseract_cmd = r'<full_path_to_your_tesseract_executable>'
# Example tesseract_cmd = r'C:\Program Files (x86)\Tesseract-OCR\tesseract'

so according to documentation i should include full path of executable installed ,but i dont know how to get the path,.i am working on linux and am new to linux.could u please hele

Stanley
  • 801
  • 2
  • 10
  • 20
biplab
  • 45
  • 4

1 Answers1

0

How to get full path of python package after installation?

To find the path to a python package you can do this

import pytesseract
print(pytesseract.__file__)

prints something like

\WPy64-3880\python-3.8.8.amd64\lib\site-packages\pytesseract\__init__.py
John
  • 1,645
  • 2
  • 17
  • 29