识别图片验证码的代码如下:
from PIL import Image
import pytesseract
imageObject=Image.open(‘D://new.jpg’)
print (imageObject)
print (pytesseract.image_to_string(imageObject))
我们发现运行时报错了
这里写图片描述
解决方法(D:/Python 该路径为Python安装位置,因人而异)
D:/Python/Lib/site-packages/pytesseract 下的 pytesseract.py文件做如下修改
这里写图片描述
执行成功结果