pyocrで文字認識をしようと試みて
下記のプログラムを実行したところ
エラーが発生した。
lang
1from PIL import Image 2import sys 3 4import pyocr 5import pyocr.builders 6 7tools = pyocr.get_available_tools() 8if len(tools) == 0: 9 print("No OCR tool found") 10 sys.exit(1) 11# The tools are returned in the recommended order of usage 12tool = tools[0] 13print("Will use tool '%s'" % (tool.get_name())) 14# Ex: Will use tool 'libtesseract' 15 16langs = tool.get_available_languages() 17print("Available languages: %s" % ", ".join(langs)) 18lang = langs[0] 19print("Will use lang '%s'" % (lang)) 20# Ex: Will use lang 'fra' 21# Note that languages are NOT sorted in any way. Please refer 22# to the system locale settings for the default language 23# to use. 24 25txt = tool.image_to_string( 26 Image.open('.png'), 27 lang="jpn", 28 builder=pyocr.builders.TextBuilder(tesseract_layout=6) 29) 30print( txt ) 31# txt is a Python string 32
エラーメッセージ
Traceback (most recent call last): File "pyocr.py", line 4, in <module> import pyocr File "C:\Users\jun_endo\Desktop\機械学習\pyocr.py", line 5, in <module> import pyocr.builders ImportError: No module named 'pyocr.builders'; 'pyocr' is not a package
エラーの意味を直訳すると
"pyocr","pyocr.builders"はパッケージではないということですが、
調べても何も出てこないので困っています。
どなたか教えてください。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。