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

 

C:\Users\k\Desktop\test>python test.py
Traceback (most recent call last):
  File "C:\Users\k\Anaconda3\lib\site-packages\pytesseract\pytesseract.py", line 184, in run_tesseract
    proc = subprocess.Popen(cmd_args, **subprocess_args())
  File "C:\Users\k\Anaconda3\lib\subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "C:\Users\k\Anaconda3\lib\subprocess.py", line 1224, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] 系统找不到指定的文件。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test.py", line 5, in <module>
    text=pytesseract.image_to_string(Image.open('xxx.png'),lang='chi_sim')
  File "C:\Users\k\Anaconda3\lib\site-packages\pytesseract\pytesseract.py", line 309, in image_to_string
    }[output_type]()
  File "C:\Users\k\Anaconda3\lib\site-packages\pytesseract\pytesseract.py", line 308, in <lambda>
    Output.STRING: lambda: run_and_get_output(*args),
  File "C:\Users\k\Anaconda3\lib\site-packages\pytesseract\pytesseract.py", line 218, in run_and_get_output
    run_tesseract(**kwargs)
  File "C:\Users\k\Anaconda3\lib\site-packages\pytesseract\pytesseract.py", line 186, in run_tesseract
    raise TesseractNotFoundError()
pytesseract.pytesseract.TesseractNotFoundError: tesseract is not installed or it's not in your path

安装软件tesseract

下载地址:https://digi.bib.uni-mannheim.de/tesseract/

再次运行可能会出现下面的问题

C:\Users\k\Desktop\test>python test.py
Traceback (most recent call last):
  File "test.py", line 5, in <module>
    text=pytesseract.image_to_string(Image.open('xxx.png'),lang='chi_sim')
  File "C:\Users\k\Anaconda3\lib\site-packages\pytesseract\pytesseract.py", line 309, in image_to_string
    }[output_type]()
  File "C:\Users\k\Anaconda3\lib\site-packages\pytesseract\pytesseract.py", line 308, in <lambda>
    Output.STRING: lambda: run_and_get_output(*args),
  File "C:\Users\k\Anaconda3\lib\site-packages\pytesseract\pytesseract.py", line 218, in run_and_get_output
    run_tesseract(**kwargs)
  File "C:\Users\k\Anaconda3\lib\site-packages\pytesseract\pytesseract.py", line 194, in run_tesseract
    raise TesseractError(status_code, get_errors(error_string))
pytesseract.pytesseract.TesseractError: (1, 'Error opening data file \\Program Files (x86)\\Tesseract-OCR\\tessdata/chi_sim.traineddata Please make sure the TESSDATA_PREFIX environment variable is set to the parent directory of your "tessdata" directory. Failed loading language \'chi_sim\' Tesseract couldn\'t load any languages! Could not initialize tesseract.')

 

解决方法:

https://www.cnblogs.com/sea-stream/p/10961580.html

 

转载于:https://www.cnblogs.com/sea-stream/p/10961540.html

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值