我正在尝试pytesseract
第一次使用。我对 python 也不太满意。我在python_test
桌面上创建了一个新文件夹。我在 Mac 上。在这个文件夹中,我有一个test.png
文件和一个 py 脚本:
from pytesseract import image_to_string
from PIL import Image
print image_to_string(Image.open('test.png'))
print image_to_string(Image.open('test-english.jpg'), lang='eng')
所以从我的终端,我进入 python_test 文件夹然后我正在运行python read.py
然后我有以下错误:
Traceback (most recent call last):
File "read.py", line 4, in <module>
print image_to_string(Image.open('test.png'))
File "/anaconda/anaconda/lib/python2.7/site-packages/pytesseract/pytesseract.py", line 161, in image_to_string
config=config)
File "/anaconda/anaconda/lib/python2.7/site-packages/pytesseract/pytesseract.py", line 94, in run_tesseract
stderr=subprocess.PIPE)
File "/anaconda/anaconda/lib/python2.7/subprocess.py", line 711, in __init__
errread, errwrite)
File "/anaconda/anaconda/lib/python2.7/subprocess.py", line 1343, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
我做错了什么?