hiroi-sora / Umi-OCR

OCR software, free and offline. 开源、免费的离线OCR软件。支持截屏/批量导入图片,PDF文档识别,排除水印/页眉页脚,扫描/生成二维码。内置多国语言库。
MIT License
27.13k stars 2.72k forks source link

【系统路径缺失】无法完成初始化,PaddleOCR-json.exe报错chcp不是内部或外部命令 #9

Closed Oldsport-996 closed 2 years ago

Oldsport-996 commented 2 years ago

您好 今天使用卡初始化了 不知道什么原因

hiroi-sora commented 2 years ago

请问以前使用是正常的吗?如果是,可能配置文件被修改过,而且参数不正确。尝试下载最新版软件,看看可否运行。

如果依然不行,尝试打开 PaddleOCR-json 文件夹下的识别引擎 PaddleOCR_json.exe ,看看它有无报错。如果有报错,则可能你的电脑安装(注册)了某些运行库与引擎产生了冲突。方便的话,把报错内容发上来。

andongya95 commented 2 years ago

作者大大您好 我在下载了1.2.6版本后也出现了初始化失败的问题 在读图后直接运行、选择识别区域、或者剪切板读取时都有同样的初始化失败报错 然后我运行了PaddleOCR_json.exe 并没有报错 最后我下回了1.2.5版本后还是可以使用的 我怀疑是 更新PaddleOCR-json模块至v1.2.0 之后有兼容问题?

hiroi-sora commented 2 years ago

@andongya95

可否将1.2.6初始化失败的弹窗截图放上来?我想看看它的信息

Oldsport-996 commented 2 years ago

image 您好 他就是一直初始化,然后软件没什么反应

hiroi-sora commented 2 years ago

运行PaddleOCR_json.exe时,是不是打印一大串日志、最后显示 OCR init completed. ?

image

Oldsport-996 commented 2 years ago

image

Oldsport-996 commented 2 years ago

image 这个任务也没法停止,一直显示 正在停止,右键关闭还关闭不了,只能用任务管理器强制关闭软件

hiroi-sora commented 2 years ago

'chcp' 不是内部或外部命令

意料之外的问题。你电脑打开cmd,输入where chcp,看看会不会输出正确的路径? 如果没有,尝试将 C:\Windows\system32 加入系统路径 如果有,尝试将 PaddleOCR_json 文件夹加入系统路径 参考:https://blog.csdn.net/weixin_38314865/article/details/84594065

这个任务也没法停止,一直显示 正在停止

OK,以后会加入超时监控以防止程序因未知原因卡死

Oldsport-996 commented 2 years ago

嗯 可以了 谢谢作者大大,我将C:\Windows\system32 加入系统路径 后 可以进行识别了

andongya95 commented 2 years ago

@hiroi-sora 我的PaddleOCR_json.exe运行后得到的是OCR init completed和图中一致 我也试了把文件夹加入系统路径,现在依然还是初始化失败的报错

hiroi-sora commented 2 years ago

@andongya95 是的,你的问题跟楼主不一样,与系统路径无关。可否在你机器上运行下述代码,看看有无问题

import os
import subprocess  # 进程,管道

# exePath = r"填入PaddleOCR_json.exe的路径"
exePath = r"D:\MyCode\PythonCode\Umi-OCR\PaddleOCR-json\PaddleOCR_json.exe"

cwd = os.path.abspath(os.path.join(exePath, os.pardir))
print(exePath, cwd)
popen = subprocess.Popen(  # 打开管道
    exePath, cwd=cwd,
    stdin=subprocess.PIPE,
    stdout=subprocess.PIPE,
)
for i in range(1000):
    if not popen.poll() == None:  # 子进程已退出,初始化失败
        print('子进程已退出,初始化失败!')
        break
    initStr = popen.stdout.readline().decode('ascii', errors='ignore')
    print(f'{i} : {initStr}')
    if 'OCR init completed.' in initStr:
        print(f'初始化成功!')
        break
    if i >= 999:
        print(f'输出条数异常,初始化失败!')
if popen.poll():
    popen.kill()
andongya95 commented 2 years ago

@hiroi-sora 我跑了之后卡在了第一次loop里 0 : Active code page: 65001 现在暂时还没动过

更新: 我发现是进程卡了 我重新跑了之后得到了 0 : Active code page: 65001 1 : OCR init completed. 初始化成功!

hiroi-sora commented 2 years ago

那既然这段demo能跑,Umi-OCR理应没问题呀

试试直接调用 callingOCR.py ,在最后加入一行

ocr = CallingOCR('填入PaddleOCR_json.exe的路径')

把第46行的initStr打印出来 把第49行的 # print(f'初始化OCR成功,进程号为{self.ret.pid}') 取消注释

看能不能初始化成功

andongya95 commented 2 years ago

image

e[37m---    fused 0 elementwise_add with relu activatione[0m
e[37m---    fused 0 elementwise_add with tanh activatione[0m
e[37m---    fused 0 elementwise_add with leaky_relu activatione[0m
e[37m---    fused 0 elementwise_add with swish activatione[0m
e[37m---    fused 0 elementwise_add with hardswish activatione[0m
e[37m---    fused 0 elementwise_add with sqrt activatione[0m
e[37m---    fused 0 elementwise_add with abs activatione[0m
e[37m---    fused 0 elementwise_add with clip activatione[0m
e[37m---    fused 0 elementwise_add with gelu activatione[0m
e[37m---    fused 0 elementwise_add with relu6 activatione[0m
e[37m---    fused 0 elementwise_add with sigmoid activatione[0m
e[37m---    fused 0 elementwise_sub with relu activatione[0m
e[37m---    fused 0 elementwise_sub with tanh activatione[0m
e[37m---    fused 0 elementwise_sub with leaky_relu activatione[0m
e[37m---    fused 0 elementwise_sub with swish activatione[0m
e[37m---    fused 0 elementwise_sub with hardswish activatione[0m
e[37m---    fused 0 elementwise_sub with sqrt activatione[0m
e[37m---    fused 0 elementwise_sub with abs activatione[0m
e[37m---    fused 0 elementwise_sub with clip activatione[0m
e[37m---    fused 0 elementwise_sub with gelu activatione[0m
e[37m---    fused 0 elementwise_sub with relu6 activatione[0m
e[37m---    fused 0 elementwise_sub with sigmoid activatione[0m
e[37m---    fused 0 elementwise_mul with relu activatione[0m
e[37m---    fused 0 elementwise_mul with tanh activatione[0m
e[37m---    fused 0 elementwise_mul with leaky_relu activatione[0m
e[37m---    fused 0 elementwise_mul with swish activatione[0m
e[37m---    fused 0 elementwise_mul with hardswish activatione[0m
e[37m---    fused 0 elementwise_mul with sqrt activatione[0m
e[37m---    fused 0 elementwise_mul with abs activatione[0m
e[37m---    fused 0 elementwise_mul with clip activatione[0m
e[37m---    fused 0 elementwise_mul with gelu activatione[0m
e[37m---    fused 0 elementwise_mul with relu6 activatione[0m
e[37m---    fused 0 elementwise_mul with sigmoid activatione[0m
e[37m---    fused 0 elementwise_add with relu activatione[0m
e[37m---    fused 0 elementwise_add with tanh activatione[0m
e[37m---    fused 0 elementwise_add with leaky_relu activatione[0m
e[37m---    fused 0 elementwise_add with swish activatione[0m
e[37m---    fused 0 elementwise_add with hardswish activatione[0m
e[37m---    fused 0 elementwise_add with sqrt activatione[0m
e[37m---    fused 0 elementwise_add with abs activatione[0m
e[37m---    fused 0 elementwise_add with clip activatione[0m
e[37m---    fused 0 elementwise_add with gelu activatione[0m
e[37m---    fused 0 elementwise_add with relu6 activatione[0m
e[37m---    fused 0 elementwise_add with sigmoid activatione[0m
e[37m---    fused 0 elementwise_sub with relu activatione[0m
e[37m---    fused 0 elementwise_sub with tanh activatione[0m
e[37m---    fused 0 elementwise_sub with leaky_relu activatione[0m
e[37m---    fused 0 elementwise_sub with swish activatione[0m
e[37m---    fused 0 elementwise_sub with hardswish activatione[0m
e[37m---    fused 0 elementwise_sub with sqrt activatione[0m
e[37m---    fused 0 elementwise_sub with abs activatione[0m
e[37m---    fused 0 elementwise_sub with clip activatione[0m
e[37m---    fused 0 elementwise_sub with gelu activatione[0m
e[37m---    fused 0 elementwise_sub with relu6 activatione[0m
e[37m---    fused 0 elementwise_sub with sigmoid activatione[0m
e[37m---    fused 0 elementwise_mul with relu activatione[0m
e[37m---    fused 0 elementwise_mul with tanh activatione[0m
e[37m---    fused 0 elementwise_mul with leaky_relu activatione[0m
e[37m---    fused 0 elementwise_mul with swish activatione[0m
e[37m---    fused 0 elementwise_mul with hardswish activatione[0m
e[37m---    fused 0 elementwise_mul with sqrt activatione[0m
e[37m---    fused 0 elementwise_mul with abs activatione[0m
e[37m---    fused 0 elementwise_mul with clip activatione[0m
e[37m---    fused 0 elementwise_mul with gelu activatione[0m
e[37m---    fused 0 elementwise_mul with relu6 activatione[0m
e[37m---    fused 0 elementwise_mul with sigmoid activatione[0m
0 : Active code page: 65001

1 : OCR init completed.

初始化成功!
e[37m---    fused 0 elementwise_add with relu activatione[0m
e[37m---    fused 0 elementwise_add with tanh activatione[0m
e[37m---    fused 0 elementwise_add with leaky_relu activatione[0m
e[37m---    fused 0 elementwise_add with swish activatione[0m
e[37m---    fused 0 elementwise_add with hardswish activatione[0m
e[37m---    fused 0 elementwise_add with sqrt activatione[0m
e[37m---    fused 0 elementwise_add with abs activatione[0m
e[37m---    fused 0 elementwise_add with clip activatione[0m
e[37m---    fused 0 elementwise_add with gelu activatione[0m
e[37m---    fused 0 elementwise_add with relu6 activatione[0m
e[37m---    fused 0 elementwise_add with sigmoid activatione[0m
e[37m---    fused 0 elementwise_sub with relu activatione[0m
e[37m---    fused 0 elementwise_sub with tanh activatione[0m
e[37m---    fused 0 elementwise_sub with leaky_relu activatione[0m
e[37m---    fused 0 elementwise_sub with swish activatione[0m
e[37m---    fused 0 elementwise_sub with hardswish activatione[0m
e[37m---    fused 0 elementwise_sub with sqrt activatione[0m
e[37m---    fused 0 elementwise_sub with abs activatione[0m
e[37m---    fused 0 elementwise_sub with clip activatione[0m
e[37m---    fused 0 elementwise_sub with gelu activatione[0m
e[37m---    fused 0 elementwise_sub with relu6 activatione[0m
e[37m---    fused 0 elementwise_sub with sigmoid activatione[0m
e[37m---    fused 0 elementwise_mul with relu activatione[0m
e[37m---    fused 0 elementwise_mul with tanh activatione[0m
e[37m---    fused 0 elementwise_mul with leaky_relu activatione[0m
e[37m---    fused 0 elementwise_mul with swish activatione[0m
e[37m---    fused 0 elementwise_mul with hardswish activatione[0m
e[37m---    fused 0 elementwise_mul with sqrt activatione[0m
e[37m---    fused 0 elementwise_mul with abs activatione[0m
e[37m---    fused 0 elementwise_mul with clip activatione[0m
e[37m---    fused 0 elementwise_mul with gelu activatione[0m
e[37m---    fused 0 elementwise_mul with relu6 activatione[0m
e[37m---    fused 0 elementwise_mul with sigmoid activatione[0m
e[37m---    fused 0 elementwise_add with relu activatione[0m
e[37m---    fused 0 elementwise_add with tanh activatione[0m
e[37m---    fused 0 elementwise_add with leaky_relu activatione[0m
e[37m---    fused 0 elementwise_add with swish activatione[0m
e[37m---    fused 0 elementwise_add with hardswish activatione[0m
e[37m---    fused 0 elementwise_add with sqrt activatione[0m
e[37m---    fused 0 elementwise_add with abs activatione[0m
e[37m---    fused 0 elementwise_add with clip activatione[0m
e[37m---    fused 0 elementwise_add with gelu activatione[0m
e[37m---    fused 0 elementwise_add with relu6 activatione[0m
e[37m---    fused 0 elementwise_add with sigmoid activatione[0m
e[37m---    fused 0 elementwise_sub with relu activatione[0m
e[37m---    fused 0 elementwise_sub with tanh activatione[0m
e[37m---    fused 0 elementwise_sub with leaky_relu activatione[0m
e[37m---    fused 0 elementwise_sub with swish activatione[0m
e[37m---    fused 0 elementwise_sub with hardswish activatione[0m
e[37m---    fused 0 elementwise_sub with sqrt activatione[0m
e[37m---    fused 0 elementwise_sub with abs activatione[0m
e[37m---    fused 0 elementwise_sub with clip activatione[0m
e[37m---    fused 0 elementwise_sub with gelu activatione[0m
e[37m---    fused 0 elementwise_sub with relu6 activatione[0m
e[37m---    fused 0 elementwise_sub with sigmoid activatione[0m
e[37m---    fused 0 elementwise_mul with relu activatione[0m
e[37m---    fused 0 elementwise_mul with tanh activatione[0m
e[37m---    fused 0 elementwise_mul with leaky_relu activatione[0m
e[37m---    fused 0 elementwise_mul with swish activatione[0m
e[37m---    fused 0 elementwise_mul with hardswish activatione[0m
e[37m---    fused 0 elementwise_mul with sqrt activatione[0m
e[37m---    fused 0 elementwise_mul with abs activatione[0m
e[37m---    fused 0 elementwise_mul with clip activatione[0m
e[37m---    fused 0 elementwise_mul with gelu activatione[0m
e[37m---    fused 0 elementwise_mul with relu6 activatione[0m
e[37m---    fused 0 elementwise_mul with sigmoid activatione[0m
Active code page: 65001

OCR init completed.

初始化OCR成功,进程号为12148
MRSUDQ commented 2 months ago

请问作者大大,用杀毒软件优化系统后,现在UMI-OCR不能打开是什么原因,点击图标没有反映,之前是能够使用的,系统是WIN7 64位。另外,我参考上面帖子的内容,运行PaddleOCR_json.exe运行后得到的是OCR init completed,如何把文件夹加入系统路径,参考您的链接没看懂,请赐教

hiroi-sora commented 2 months ago

请问作者大大,用杀毒软件优化系统后,现在UMI-OCR不能打开是什么原因,点击图标没有反映,之前是能够使用的,系统是WIN7 64位。另外,我参考上面帖子的内容,运行PaddleOCR_json.exe运行后得到的是OCR init completed,如何把文件夹加入系统路径,参考您的链接没看懂,请赐教

可能杀软删除了一些文件。重新下载解压一次试试

MRSUDQ commented 2 months ago

谢谢您的回复,已经重新再下载了三个版本,1.12的可以运行,但是没有截图识别功能,2.12 2.13都不能用,依然是点击图标没反应

MRSUDQ commented 2 months ago

运行PaddleOCR_json.exe的前面是提示 路径缺失,然后是一堆验证,最后是 OCR init completed

hiroi-sora commented 2 months ago

2.12 2.13都不能用,依然是点击图标没反应

看来 PaddleOCR-json 引擎是没有问题的。可能问题出在前端。

请尝试:运行 UmiOCR-data目录中的RUN_CLI.bat ,有什么反应?

如果没反应,回到上一级 Umi-OCR 目录,在此处打开终端或Powershell,输入./umi-ocr 回车。有什么反应?

MRSUDQ commented 2 months ago

2024-08-13_085914 运行RUN_CLI.bat可打开dos界面,然后闪退,运行powershell显示如上图

MRSUDQ commented 2 months ago

不好意思,这里才是子目录下的powershell 2024-08-14_160528

hiroi-sora commented 2 months ago

这里才是子目录下的powershell

你应该在 Umi-OCR_Paddle_v2.1.3 目录中,执行 ./umi-ocr 。(实质是通过命令行调用 Umi-OCR.exe 这个exe文件,看看有什么报错输出,以便对症下药)

如果还是还有任何反应,可能有一些较难解决的兼容性问题。你可使用 1.3.7 版本,这是最后一个 v1 稳定版本,具有截图功能。

https://github.com/hiroi-sora/Umi-OCR/releases/tag/v1.3.7