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

痞子三分冷 提交于 2020-01-03 17:01:20

问题


I am new to text extraction.when i try to extract text from a png image using pytesseract as

from PIL import Image
import pytesseract
s=Image.open('d:\\test.png')
print(pytesseract.image_to_string(s))

I am getting error as Is this the problem of image(test.png).the test.png is the image of a number plate.Should i need to install anything else.


回答1:


according to the PyPi information there is a perquisite that you are missing:

Install google tesseract-ocr from http://code.google.com/p/tesseract-ocr/ . You must be able to invoke the tesseract command as "tesseract". If this isn't the case, for example because tesseract isn't in your PATH, you will have to change the "tesseract_cmd" variable at the top of 'tesseract.py'.

and that link redirected me to https://github.com/tesseract-ocr/tesseract

I'm frankly disappointed that the package doesn't give you a more informative message that you are missing this, anyway once you have installed the underlying tesseract command pytesseract should work correctly :)



来源:https://stackoverflow.com/questions/36813344/pytesseract-windowserror-error-2-the-system-cannot-find-the-file-specified

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!