错误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
好像你没有安装 tesseract-ocr
,如果你使用的是基于 debian 的发行版,试试这个:
$ sudo apt-get install tesseract-ocr
我想尝试读取简单的图像但是我有以下错误:
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