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

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 关于#wireshark#的问题:并且能够给数据做标注,如这个流量是在看视频或者是在转账
  • ¥90 请问,这个视频播放软件的名称,用过的朋友请给答案,上方..avi是啥意思?是看短剧还是播放本地视频?
  • ¥15 运筹优化,gurobi,python
  • ¥15 基于python的电影系统推荐
  • ¥20 springmvc重定向和返回json
  • ¥15 数学建模——参会安排怎么做
  • ¥15 电脑键盘实现触摸功能
  • ¥25 matlab无法将表达式转换为双数组怎么解决?
  • ¥15 单片机汇编语言相关程序
  • ¥20 家用射频美容仪技术规格