問題描述
錯誤 2 在 pytesseract 中沒有這樣的文件或目錄 (Error 2 No such file or directory in pytesseract)
我想嘗試閱讀簡單的圖像但我有以下錯誤:
import requests
import pytesseract
from PIL import Image
from StringIO import StringIO
from lxml import html
session=requests.Session()
cont=session.get('http://This_site.com/').content
tree=html.fromstring(cont)
token=tree.xpath(...)
session_id=token.split(...)
response=session.get('http://This_site.com/'+session_id)
captcha=pytesseract.image_to_string(Image.open(StringIO(response.content)))
print captcha
錯誤:
[Errno 2] No such file or directory
參考解法
方法 1:
Seems like you don't have tesseract‑ocr
installed, try this one if you're using debian‑based distro:
$ sudo apt‑get install tesseract‑ocr