Skyexu / TopSup

答题辅助决策:头号英雄等答题类游戏
https://www.jianshu.com/p/dc828c4b901d
1.32k stars 351 forks source link

运行GetQuestionTessAndroid.py报错,找不到指定文件 #114

Closed jacknonebug closed 6 years ago

jacknonebug commented 6 years ago

python小白,求指教!

采用方式 2 获取截图 Traceback (most recent call last): File "d:\TopSup\GetQuestionTessAndroid.py", line 20, in question, choices = ocr.ocr_img(img) File "d:\TopSup\common\ocr.py", line 76, in ocr_img question = pytesseract.image_to_string(question_im, lang='chi_sim', config=tessdata_dir_config) File "D:\Python\lib\site-packages\pytesseract\pytesseract.py", line 122, in image_to_string config=config) File "D:\Python\lib\site-packages\pytesseract\pytesseract.py", line 46, in run_tesseract proc = subprocess.Popen(command, stderr=subprocess.PIPE) File "D:\Python\lib\subprocess.py", line 709, in init restore_signals, start_new_session) File "D:\Python\lib\subprocess.py", line 997, in _execute_child startupinfo) FileNotFoundError: [WinError 2] 系统找不到指定的文件。

cycaoecw commented 6 years ago

你还没有导入语言包chi_sim.traineddata,上githug下载一个吧https://github.com/tesseract-ocr/tesseract/wiki/Data-Files

jacknonebug commented 6 years ago

还是不行啊,更改了tesseract的路径,然后报这个错误 采用方式 2 获取截图 Traceback (most recent call last): File "D:\TopSup\GetQuestionTessAndroid.py", line 20, in question, choices = ocr.ocr_img(img) File "D:\TopSup\common\ocr.py", line 76, in ocr_img question = pytesseract.image_to_string(question_im, lang='chi_sim', config=tessdata_dir_config) File "D:\Python\lib\site-packages\pytesseract\pytesseract.py", line 125, in image_to_string raise TesseractError(status, errors) pytesseract.pytesseract.TesseractError: (1, 'Error opening data file D:\Program Files (x86)\Tesseract-OCR\tessdata/chi_sim.traineddata')

ning-chao commented 6 years ago

现在可以进行搜索了,但是总搜出来乱七八糟的东西

zyaloon commented 6 years ago

你改错文件了,找一下tesseract的路径,pytesseract是Python的文件

jacknonebug commented 6 years ago

可以了,但是感觉google的没有百度识别准确