我正在使用Ubuntu 14.04.我有以下代码:
import Image
import pytesseract
im = Image.open('test.png')
print pytesseract.image_to_string(im)
Run Code Online (Sandbox Code Playgroud)
但我一直收到以下错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 540, in runfile
execfile(filename, namespace)
File "/home/chaitanya/pythonapp/localcopy.py", line 4, in <module>
print pytesseract.image_to_string(im)
File "/usr/local/lib/python2.7/dist-packages/pytesseract/pytesseract.py", line 142, in image_to_string
config=config)
File "/usr/local/lib/python2.7/dist-packages/pytesseract/pytesseract.py", line 75, in run_tesseract
stderr=subprocess.PIPE)
File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
Run Code Online (Sandbox Code Playgroud)
python程序和图像都在同一个位置.可能是什么问题?
我正在尝试在python中运行基本且非常简单的代码。
from PIL import Image
import pytesseract
im = Image.open("sample1.jpg")
text = pytesseract.image_to_string(im, lang = 'eng')
print(text)
Run Code Online (Sandbox Code Playgroud)
看起来就是这样,我实际上已经通过安装程序为Windows安装了tesseract。我是Python的新手,不确定如何继续?
这里的任何指导将非常有帮助。我尝试重新启动Spyder应用程序,但无济于事。