2016-12-29 5 views
0

ich verwende pytesseract auf Windows 10 x64 und Python ist 3.5.2 x64, Tesseract 4.0 ist, wird der Code wie folgt:pytesseract auf Windows 10: Fehler beim Öffnen der Datendatei

# -*- coding: utf-8 -*- 

try: 
    import Image 
except ImportError: 
    from PIL import Image 
import pytesseract 


print(pytesseract.image_to_string(Image.open('d:/testimages/name.gif'), lang='chi_sim')) 

Fehler:

Traceback (most recent call last): 
    File "D:/test.py", line 10, in <module> 
    print(pytesseract.image_to_string(Image.open('d:/testimages/name.gif'), lang='chi_sim')) 
    File "C:\Users\dell\AppData\Local\Programs\Python\Python35\lib\site-packages\pytesseract\pytesseract.py", line 165, in image_to_string 
    raise TesseractError(status, errors) 
pytesseract.pytesseract.TesseractError: (1, 'Error opening data file \\Program Files (x86)\\Tesseract-OCR\\tessdata/chi_sim.traineddata') 

C:\Program Files (x86)\Tesseract-OCR\tessdata, wie folgt aus:

enter image description here

warum ist es?

+0

Gibt es auch für andere Sprachen arbeiten? – sayan

+0

Verwandte: http://stackoverflow.com/questions/24672531/annoying-python-tesseract-error-error-opening-data-file-tessdata-eng-trainedda – sayan

Antwort

0

Set TESSDATA_PREFIX Umgebungsvariable C:\Program Files (x86)\Tesseract-OCR\

0

Wenn Sie tessdata Fehler wie haben: „Fehler Datei öffnen Daten ...“

tessdata_dir_config = '--tessdata-dir "<replace_with_your_tessdata_dir_path>"' 
# Example config: '--tessdata-dir "C:\\Program Files (x86)\\Tesseract-OCR\\tessdata"' 
# It's important to add double quotes around the dir path. 

pytesseract.image_to_string(image, lang='chi_sim', config=tessdata_dir_config) 
+0

tessdata_dir_config = ‚--tessdata-dir„C: \\ Tesseract-OCR \\ tessdata "' – dubinglin

+0

Ist Ihnen bewusst, dass Sie Ihre Antwort bearbeiten können? – Yunnosch

Verwandte Themen