天天看點

python爬蟲識别簡單的驗證碼python爬蟲識别簡單的驗證碼

python爬蟲識别簡單的驗證碼

準備工作

下載下傳安裝:

  1. pillow
  2. tesseract

下載下傳安裝pillow

直接pip安裝

pip install Pillow -i https://pypi.tuna.tsinghua.edu.cn/simple
           

下載下傳tesseract

tesseract下載下傳位址:link

我選擇的 tesseract-ocr-setup-3.05.02-20180621.exe版本。下載下傳比較慢。

python爬蟲識别簡單的驗證碼python爬蟲識别簡單的驗證碼
安裝tesseract

安裝可以一路next,Additional language data(download)選項是安裝OCR識别支援的語言包,這裡我就勾選chinese的那兩個,要不然下載下傳慢,也可以手動去下載下傳語言包。

python也要安裝:

pip install pytesseract
           
加個環境變量

系統變量裡添加路徑,添加後可以指令行輸入tesseract -v 檢視

D:\Program Files (x86)\Tesseract-OCR(你自己的安裝路徑)

最後簡單測試了下
python爬蟲識别簡單的驗證碼python爬蟲識别簡單的驗證碼

是可以輸出 0924 的。