user4973313
user4973313

Reputation: 39

how to install ocr engine (tesseract) and pyteeser for python2.7 in windows7

Can you please help me to install tesseract and pyteeser for Python2.7 on Windows 7?

A download link and detailed steps how to install these packages would be preferred.

I tried using easy_install but it threw an error

I installed pyteeser, also changed import Image to from PIL import image in pyteeser.py file.

But now i am getting this error

File "C:\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 699, in runfile execfile(filename, namespace)

File "C:\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 74, in execfile exec(compile(scripttext, filename, 'exec'), glob, loc)

File "C:/Users/Duggentious/Documents/Python Scripts/print inspection/ocrstore.py", line 15, in text = image_to_string(im)

File "C:\Anaconda2\lib\site-packages\pytesser.py", line 31, in image_to_string call_tesseract(scratch_image_name, scratch_text_name_root)

File "C:\Anaconda2\lib\site-packages\pytesser.py", line 21, in call_tesseract proc = subprocess.Popen(args)

File "C:\Anaconda2\lib\subprocess.py", line 710, in init errread, errwrite)

File "C:\Anaconda2\lib\subprocess.py", line 958, in _execute_child startupinfo)

WindowsError: [Error 2] The system cannot find the file specified``

Upvotes: 0

Views: 518

Answers (1)

Try my guide - it may work for you.

Steps for getting pytesseract working on windows.

  1. Install Anaconda 2 or Anaconda 3 from https://www.continuum.io/downloads
  2. Install tesseract for windows from http://digi.bib.uni-mannheim.de/tesseract/tesseract-ocr-setup-4.00.00dev.exe
  3. Add the tesseract directory to windows as a PATH environment variable.
  4. Install pytesseract e.g. pip install pytesseract and..

    import pytesseract
    from PIL import Image
    image = Image.open('example_02.png')
    code = pytesseract.image_to_string(image)
    print code
    

voila.

Upvotes: 0

Related Questions