我不断收到以下代码错误:
import pytesseract
from PIL import Image, ImageEnhance, ImageFilter
im = Image.open("book.jpg") # the second one
im = im.filter(ImageFilter.MedianFilter())
enhancer = ImageEnhance.Contrast(im)
im = enhancer.enhance(2)
im = im.convert('1')
text = pytesseract.image_to_string(im)
print text
错误是:
File "demo2.py", line 9, in <module>
text = pytesseract.image_to_string(im)
File "/home/vagrant/src/env/local/lib/python2.7/site-packages/pytesseract/pytesseract.py", line 161, in image_to_string
config=config)
File "/home/vagrant/src/env/local/lib/python2.7/site-packages/pytesseract/pytesseract.py", line 94, in run_tesseract
stderr=subprocess.PIPE)
File "/usr/lib/python2.7/subprocess.py", line 711, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
我不确定这是安装问题还是其他问题。我阅读了OSError: [Errno 2] No such file or directory using pytesser的答案,但他们没有帮助我。