suiyidemingzi 2022-09-11 12:26 采纳率: 100%
浏览 62
已结题

python中下载tesserocr报错

问题遇到的现象和发生背景

问题:在Python上多次尝试安装tesserocr出现报错
背景:已安装完成tesseract,pillow,wheel,但没确定过版本,在cmd下可以查询到tesseract,已设置好tesseract.exe和tessdate的系统环境下的路径.

img

img

img

问题相关代码

在尝试最终pip install tesserocr时报错

运行结果及报错内容
Collecting tesserocr
  Using cached tesserocr-2.5.2.tar.gz (57 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [44 lines of output]
      Failed to extract tesseract version number from: tesseract v5.2.0.20220712

       leptonica-1.78.0

        libgif 5.1.4 : libjpeg 8d (libjpeg-turbo 1.5.3) : libpng 1.6.34 : libtiff 4.0.9 : zlib 1.2.11 : libwebp 0.6.1 : libopenjp2 2.3.0

       Found AVX2

       Found AVX

       Found FMA

       Found SSE4.1

       Found libarchive 3.5.0 zlib/1.2.11 liblzma/5.2.3 bz2lib/1.0.6 liblz4/1.7.5 libzstd/1.4.5

       Found libcurl/7.77.0-DEV Schannel zlib/1.2.11 zstd/1.4.5 libidn2/2.0.4 nghttp2/1.31.0
      Supporting tesseract v3.04.00
      Tesseract major version 3
      Traceback (most recent call last):
        File "C:\Users\mao'xi'zhou\AppData\Local\Temp\pip-install-zeb2ridn\tesserocr_a7c4cf0874344db0a6dd2df338154578\setup.py", line 243, in get_build_args
          build_args = package_config()
        File "C:\Users\mao'xi'zhou\AppData\Local\Temp\pip-install-zeb2ridn\tesserocr_a7c4cf0874344db0a6dd2df338154578\setup.py", line 99, in package_config
          p = subprocess.Popen(
        File "C:\Users\mao'xi'zhou\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 854, in __init__
          self._execute_child(args, executable, preexec_fn, close_fds,
        File "C:\Users\mao'xi'zhou\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 1307, in _execute_child
          hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
      FileNotFoundError: [WinError 2] 系统找不到指定的文件。

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\mao'xi'zhou\AppData\Local\Temp\pip-install-zeb2ridn\tesserocr_a7c4cf0874344db0a6dd2df338154578\setup.py", line 327, in <module>
          ext_modules=[make_extension()],
        File "C:\Users\mao'xi'zhou\AppData\Local\Temp\pip-install-zeb2ridn\tesserocr_a7c4cf0874344db0a6dd2df338154578\setup.py", line 260, in make_extension
          build_args = get_build_args()
        File "C:\Users\mao'xi'zhou\AppData\Local\Temp\pip-install-zeb2ridn\tesserocr_a7c4cf0874344db0a6dd2df338154578\setup.py", line 252, in get_build_args
          build_args = get_tesseract_version()
        File "C:\Users\mao'xi'zhou\AppData\Local\Temp\pip-install-zeb2ridn\tesserocr_a7c4cf0874344db0a6dd2df338154578\setup.py", line 216, in get_tesseract_version
          raise RuntimeError(error)
      RuntimeError: Tesseract library not found in LIBPATH: []
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
我的解答思路和尝试过的方法

网上都搜索过尝试过解决办法,但没有找到与自己相适应的。
我成功下载了pytesseract模块,但却给予图片没有给出识别的内容。

>>>image2
<PIL.Image.Image image mode=L size=160x60 at 0x1436019AF40>
>>>s=pt.image_to_string(image2)
>>>s
''
  • 写回答

2条回答 默认 最新

  • CSDN-Ada助手 CSDN-AI 官方账号 2022-09-11 14:01
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 9月19日
  • 已采纳回答 9月11日
  • 创建了问题 9月11日

悬赏问题

  • ¥15 WPF动态创建页面内容
  • ¥15 如何对TBSS的结果进行统计学的分析已完成置换检验,如何在最终的TBSS输出结果提取除具体值及如何做进一步相关性分析
  • ¥15 SQL数据库操作问题
  • ¥100 关于lm339比较电路出现的问题
  • ¥15 Matlab安装yalmip和cplex功能安装失败
  • ¥15 加装宝马安卓中控改变开机画面
  • ¥15 STK安装问题问问大家,这种情况应该怎么办
  • ¥15 关于罗技鼠标宏lua文件的问题
  • ¥15 halcon ocr mlp 识别问题
  • ¥15 已知曲线满足正余弦函数,根据其峰值,还原出整条曲线