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

使用pytesseract識別驗證碼中遇到異常以下:git

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

安裝Pillow,命令pip install Pillow,安裝完畢會在Python文件夾下Lib\site-packages\pytesseract這個文件夾,裏面有pytesseract.py文件github

檢查上述報錯中的pytesseract.py源碼,發現以下說明:spa

# CHANGE THIS IF TESSERACT IS NOT IN YOUR PATH, OR IS NAMED DIFFERENTLY

tesseract_cmd = 'tesseract'

從網上找到相應的‘Tesseract-OCR’下載安裝(尋找對應版本):https://github.com/tesseract-ocr/tesseract/wiki.net

安裝後的默認文件路徑爲(這裏使用的是Windows版本):C:\Program Files (x86)\Tesseract-OCR\code

而後將源碼中的:blog

tesseract_cmd = 'tesseract'

更改成:ip

tesseract_cmd = r'C:\Program Files (x86)\Tesseract-OCR\tesseract.exe'

版權聲明:本文爲CSDN博主「大王大大王」的原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處連接及本聲明。
原文連接:https://blog.csdn.net/wang_hugh/article/details/80760940cmd

相關文章
相關標籤/搜索