pytesseract throw FileNotFoundError:[WinError 2]系统找不到指定的文件

时间:2017-05-20 02:05:55

标签: python image

我在python 3.x中使用pytesseract并尝试将图像转换为文本。

运行代码:

from pytesseract import image_to_string
from PIL import Image

im = Image.open('image.bmp')
print(im)
print(image_to_string(im)

给出输出:

>>> ================================ RESTART ================================
>>> 
<PIL.BmpImagePlugin.BmpImageFile image mode=RGB size=563x558 at 0x2D9C350>
Traceback (most recent call last):
  File "C:\Users\ADMIN\Desktop\image.py", line 6, in <module>
    s= image_to_string(im)
  File "C:\Python34\lib\site-packages\pytesseract\pytesseract.py", line 161, in image_to_string
    config=config)
  File "C:\Python34\lib\site-packages\pytesseract\pytesseract.py", line 94, in run_tesseract
    stderr=subprocess.PIPE)
  File "C:\Python34\lib\subprocess.py", line 848, in __init__
    restore_signals, start_new_session)
  File "C:\Python34\lib\subprocess.py", line 1104, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
>>> 

PIL似乎正在加载图像就好了,但是pytesseract正在抛出FileNotFoundError而我不知道为什么。任何帮助非常感谢!

0 个答案:

没有答案