Python错误集锦:pytesseract提示TesseractNotFoundError: tesseract is not installed or it’s not in your PATH.





原文链接:http://www.juzicode.com/python-error-tesseractnotfounderror-tesseract-is-not-installed-or-not-in-your-path

错误提示:

pytesseract提示TesseractNotFoundError: tesseract is not installed or it’s not in your PATH.

#juzicode.com / VX公众号:桔子code  
import pytesseract as ts
version = ts.get_tesseract_version()
print('version:',version)

==========运行结果:

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
d:\python\python38\lib\site-packages\pytesseract\pytesseract.py in get_tesseract_version()
    382         return LooseVersion(
--> 383             subprocess.check_output(
    384                 [tesseract_cmd, '--version'],

..........

FileNotFoundError: [WinError 2] 系统找不到指定的文件。

During handling of the above exception, another exception occurred:

TesseractNotFoundError                    Traceback (most recent call last)
<ipython-input-3-1b89f7eb491a> in <module>
      1 #juzicode.com / VX公众号:桔子code
      2 import pytesseract as ts
----> 3 version = ts.get_tesseract_version()
      4 print('version:',version)

d:\python\python38\lib\site-packages\pytesseract\pytesseract.py in wrapper(*args, **kwargs)
    146     def wrapper(*args, **kwargs):
    147         if wrapper._result is wrapper:
--> 148             wrapper._result = func(*args, **kwargs)
    149         return wrapper._result
    150 

d:\python\python38\lib\site-packages\pytesseract\pytesseract.py in get_tesseract_version()
    391         )
    392     except OSError:
--> 393         raise TesseractNotFoundError()
    394 
    395 

TesseractNotFoundError: tesseract is not installed or it's not in your PATH. See README file for more information.

错误原因:

1、没有安装tesseract命令行工具,或者已经安装了,没有添加安装路径到PATH系统变量中。

解决方法:

1、通过“此电脑–右键属性–高级系统设置–系统属性–高级–环境变量”:

找到“系统变量–Path–编辑”,然后新建一条tesseract的安装路径:

修改后重启命令行或者jupyter:

==========运行结果:
version: 5.0.0

扩展内容:

  1. Tesseract-OCR5.0命令类型
  2. Tesseract-OCR5.0软件安装和语言包安装(Windows系统)


如果本文还没有完全解决你的疑惑,你也可以在微信公众号“桔子code”后台给我留言,欢迎一起探讨交流。

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注