源码:#coding:utf-8#buildbyLandGrey2016-05-17try:importpytesseractfromPILimportImageexceptImportError:print"模块导入错误,请用pip安装,pytesseract依赖以下库:"raiseSystem...
源码:
#coding:utf-8
#build by LandGrey 2016-05-17
try:
import pytesseract
from PIL import Image
except ImportError:
print "模块导入错误,请用pip安装,pytesseract依赖以下库:"
raise SystemExit
img = Image.open(r'F://work//test//python//222.png')
vcode = pytesseract.image_to_string(img)
print vcode
执行结果
F:\work\test\python>python tes2.py
Traceback (most recent call last):
File "tes2.py", line 11, in
vcode = pytesseract.image_to_string(img)
File "build\bdist.win-amd64\egg\pytesseract\pytesseract.py", line 193, in imag
e_to_string
File "build\bdist.win-amd64\egg\pytesseract\pytesseract.py", line 130, in run_
and_get_output
File "build\bdist.win-amd64\egg\pytesseract\pytesseract.py", line 69, in save_
image
File "build\bdist.win-amd64\egg\pytesseract\pytesseract.py", line 65, in prepa
re
TypeError: Unsupported image object
使用的python 版本2.7
展开