pytesseract安装过程,教程很多、很多,这里就不赘述了如下链接:
https:///weixin_42341986/article/details/80882413
看重点、看重点、看重点
看到好多教程都讲到,在D:\Python37\Lib\site-packages\pytesseract路径下修改pytesseract.py文件
如:
将这个tesseract_cmd = 'tesseract' 改为:tesseract_cmd ='D:\Program Files (x86)\Tesseract-OCR\tesseract.exe'
实际上正确修改方法
这样执行完后应该不会再报系统找不到指定文件的错了……
如还报其他错就最后一个大招,重启电脑。我的就是修改完还报错,重启后大功告成。。。。。
#英文
import pytesseract
from PIL import Image
image = Image.open('D:/Python/selenium/project/diseasedetection/image.png')
vcode = pytesseract.image_to_string(image)
print (vcode)
#中文
import pytesseract
from PIL import Image
file_path="./pic/image.jpg"
image = Image.open(file_path)
vcode = pytesseract.image_to_string(image,lang="chi_sim")
print (vcode)
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- oldu.cn 版权所有 浙ICP备2024123271号-1
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务