小编gra*_*ant的帖子

OSError:[Errno 2]没有使用pytesser的文件或目录

这是我的问题,我想用pytesser来获取图片的内容.我的操作系统是Mac OS 10.11,我已经安装了PIL,pytesser,tesseract-ocr引擎和其他支持库,如libpng等.但是当我运行我的代码时,如下所示,会发生错误.

from pytesser import *
import os
image = Image.open('/Users/Grant/Desktop/1.png')
text = image_to_string(image)
print text
Run Code Online (Sandbox Code Playgroud)

接下来是错误消息

Traceback (most recent call last):
File "/Users/Grant/Documents/workspace/image_test/image_test.py",    line 10, in <module>
text = image_to_string(im)
File   "/Users/Grant/Documents/workspace/image_test/pytesser/pytesser.py", line   30, in image_to_string
call_tesseract(scratch_image_name, scratch_text_name_root)
File "/Users/Grant/Documents/workspace/image_test/pytesser/pytesser.py", line 21, in call_tesseract
retcode = subprocess.call(args)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 522, in call
return Popen(*popenargs, **kwargs).wait()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 2] No such file …
Run Code Online (Sandbox Code Playgroud)

python error-handling python-tesseract pytesser

6
推荐指数
3
解决办法
1万
查看次数