【问题标题】:WindowsError: [Error 2] The system cannot find the file specified for pytesseractWindowsError: [错误 2] 系统找不到为 pytesseract 指定的文件
【发布时间】:2017-06-29 10:08:34
【问题描述】:

我正在尝试使用 pytesseract 进行 OCR,但出现 Windows 错误。请帮忙。

from PIL import Image
from pytesseract import image_to_string
import matplotlib.pyplot as plt

加载图片

im = Image.open('image_112472.jpg') # the second one
im.load()

打印文本

print(image_to_string(im,lang='eng'))

我收到以下错误

Traceback (most recent call last):


 File "C:/Users/amuly/PycharmProjects/P1/Teeth_detection/test1.py", line 17, in <module>
    print(image_to_string(im,lang='eng'))
  File "C:\Users\amuly\Anaconda2\lib\site-packages\pytesseract\pytesseract.py", line 122, in image_to_string
    config=config)
  File "C:\Users\amuly\Anaconda2\lib\site-packages\pytesseract\pytesseract.py", line 46, in run_tesseract
    proc = subprocess.Popen(command, stderr=subprocess.PIPE)
  File "C:\Users\amuly\Anaconda2\lib\subprocess.py", line 390, in __init__
    errread, errwrite)
  File "C:\Users\amuly\Anaconda2\lib\subprocess.py", line 640, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified

【问题讨论】:

    标签: python python-2.7 ocr


    【解决方案1】:

    您必须确保 tesseract.exe 在您的计算机上(例如通过安装 Tesseract-OCR),然后将包含文件夹添加到您的 PATH 环境变量中,或者使用声明它的位置

    import pytesseract
    pytesseract.pytesseract.tesseract_cmd attribute
    

    【讨论】:

      猜你喜欢
      • 2016-08-17
      • 2018-10-21
      • 2011-07-16
      • 1970-01-01
      • 2014-04-12
      • 1970-01-01
      • 2017-05-02
      • 2018-03-26
      • 1970-01-01
      相关资源
      最近更新 更多