使用pytesseract識別驗證碼中遇到tesseract is not installed or it's not in your path解決方案


在windows操作系統中,當使用pytesseract對圖像中的驗證碼進行識別時會遇到以下問題:

pytesseract.pytesseract.TesseractNotFoundError: tesseract is not installed or it's not in your path

給出以下解決方案:

(1)首先下載tesseract-ocr。

下載地址為藍奏雲網盤:https://wws.lanzous.com/iFyShmujych
密碼:5nc2

下載成功之后,對下圖所示的文件進行安裝, 不過在安裝時要記住安裝的目錄。

(2)安裝文件

安裝成功之后,打開安裝的文件所在的目錄。例如我的安裝目錄為:S:\Programs\Python\Python37-32\Tesseract-OCR\tesseract.exe。

(3)配置路徑

對畫紅圈的地方中的‘tesseract’修改為安裝tesseract-ocrde的安裝目錄。我安裝在D:\tesseract\Tesseract-OCR\tesseract.exe

重新運行程序即可。

from PIL import Image
import pytesseract
 
num_1 = Image.open(r'.\imgs\2.png')
print(pytesseract.image_to_string(num_1))

原文地址https://blog.csdn.net/weixin_41644725/article/details/9534492


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM