我想尝试读取简单的图像,但是出现以下错误:
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
似乎您尚未tesseract-ocr
安装,如果您使用的是基于debian的发行版,请尝试以下方法:
$ sudo apt-get install tesseract-ocr
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句