Installed tesserac and confirmed that it works without problems on the console.

But install the pyocr module
When the following code is executed. The output of tools is [] and nothing is returned.
As a result, No OCR tool found is output due to error processing.
What should I do?
Thanks for your patience.

Reference: https://qiita.com/rrryutaro/items/0c0a7382560e1f67123b

  • Environment
    Python 3.6.4 :: Anaconda custom (64-bit)

  • How to install tesserac
    C: \ Program Files (x86) \ Tesseract-OCR
    Japanese data
    C: \ Program Files (x86) \ Tesseract-OCR \ tessdata \ jpn.traineddata

  • Introduction method pyocr
    On the anaconda prompt pip install pyocr
    It was out of success.

from PIL import Image
import sys
import pyocr
import pyocr.builders
import matplotlib.pyplot as plt
tools = pyocr.get_available_tools ()
print tools
if len (tools) == 0:
    print ("No OCR tool found")
    sys.exit (1)
tool = tools [0]
txt = tool.image_to_string (Image.open ("hoge.png"), lang = "jpn", builder = pyocr.builders.TextBuilder (tesseract_layout = 6))
print (txt)
No OCR tool found
An exception has occurred, use% tb to see the full traceback.
SystemExit: 1

C: \ Users \ omoiy \ Anaconda3 \ lib \ site-packages \ IPython \ core \ interactiveshell.py: 2918: UserWarning: To exit: use 'exit', 'quit', or Ctrl-D.
  warn ("To exit: use 'exit', 'quit', or Ctrl-D.", stacklevel = 1)
  • Answer # 1


    Did you restart your PC after registering C: \ Program Files (x86) \ Tesseract-OCR in the environment variable: PATH?

Related articles