2019.8.4
OS: Windows8.1專業(yè)版
- 安裝tesserocr, pytesseract庫(kù)
- Tesseract是一個(gè)開源的ocr引擎,可以開箱即用,項(xiàng)目最初由惠普實(shí)驗(yàn)室支持,1996年被移植到Windows上,1998年進(jìn)行了C++化。在2005年Tesseract由惠普公司宣布開源。2006年到現(xiàn)在,都由Google公司開發(fā)。
- pytesseract是對(duì)tesseract做的一層Python API封裝,是Google的Tesseract-OCR引擎包裝器;所以它們的核心是tesseract,因此在安裝tesserocr之前,我們需要先安裝tesseract。
- tesseract OCR由C/C++編寫,github地址。
-
pip install tesserocr報(bào)錯(cuò),通過(guò)tesserocr whl文件下載whl文件安裝,cd到下載目錄pip install tesserocr-2.4.0-cp37-cp37m-win_amd64.whl,這個(gè)版本支持tesseract v4.0.0。也可以嘗試用conda安裝。 - 通過(guò)https://digi.bib.uni-mannheim.de/tesseract/,這里可以下載到舊版本。下載
tesseract-ocr-w64-setup-v4.0.0.20181030.exe安裝。 - 將tessertocr目錄和子目錄tessdata添加進(jìn)環(huán)境變量。命令行輸入
tesserart顯示信息。 - tesserocr庫(kù)識(shí)別準(zhǔn)確率不高,改用
pip install pytesseract安裝pytesseract,uni-mannheim下載tesseract-ocr-w64-setup-v5.0.0.20190623.exe安裝。方便,準(zhǔn)確率高,支持最新版本的tesseract-ocr。 - tesserocr不好用,pytesseract更好。
- python faker庫(kù)
- 安裝
pip install faker,調(diào)用
from faker import Faker f = Faker(locale='zh') # 輸入zh與zh_CN等效,zh_TW為臺(tái)灣地區(qū) f.name() # 隨機(jī)姓名 f.address() # 隨機(jī)省市路座郵編搭配- 更多細(xì)節(jié)見Python Faker的使用(1):基礎(chǔ)使用方法與函數(shù)速查--三胖道長(zhǎng)
- 安裝