OSError: [WinError 740] 请求的操作需要提升 [英] OSError: [WinError 740] The requested operation requires elevation

查看:84
本文介绍了OSError: [WinError 740] 请求的操作需要提升的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的代码,其中包含一个名为try.png"的图像,我想使用 pytesseract 将其从图像转换为文本,但代码存在一些问题.

I am having a simple code which has an image called "try.png" and I want to convert it from Image to Text using pytesseract but I am having some issues with the code.

import cv2
import pytesseract
pytesseract.pytesseract.tesseract_cmd=r'tesseract-ocr-setup-4.00.00dev.exe'
img = cv2.imread('try.png')
img= cv2.cvtColor(img,cv2.COLOR_BGR2RGB)
print(pytesseract.image_to_string(img))

但它给了我一个错误.

Traceback (most recent call last):
  File "C:/Users/user 1/PycharmProjects/JARVIS/try.py", line 6, in <module>
    print(pytesseract.image_to_string(img))
  File "C:\Users\user 1\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pytesseract\pytesseract.py", line 356, in image_to_string
    return {
  File "C:\Users\user 1\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pytesseract\pytesseract.py", line 359, in <lambda>
    Output.STRING: lambda: run_and_get_output(*args),
  File "C:\Users\user 1\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pytesseract\pytesseract.py", line 270, in run_and_get_output
    run_tesseract(**kwargs)
  File "C:\Users\user 1\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pytesseract\pytesseract.py", line 241, in run_tesseract
    raise e
  File "C:\Users\user 1\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pytesseract\pytesseract.py", line 238, in run_tesseract
    proc = subprocess.Popen(cmd_args, **subprocess_args())
  File "C:\Users\user 1\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\user 1\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 1307, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
OSError: [WinError 740] The requested operation requires elevation

Process finished with exit code 1

关于如何克服这个错误的任何想法

Any idea on how to over come this error

推荐答案

tesseract-ocr-setup-4.00.00dev.exe 听起来像一个安装 exe 而不是 tesseract 本身.检查您是否实际安装了tesseract,如果没有启动exe进行安装.

tesseract-ocr-setup-4.00.00dev.exe sounds like a setup exe and not the tesseract itself. Check if you have actually installed tesseract and if not launch the exe to install.

对于 Windows,从这里下载最新版本:https://github.com/UB-Mannheim/tesseract/wiki

For Windows download the latest version from here: https://github.com/UB-Mannheim/tesseract/wiki

如果您仍然遇到 OSError: [WinError 740] 请求的操作需要提升 尝试将 tesseract 可执行文件更改为以管理员身份运行:右键单击 tesseract.exe ->属性 ->兼容性 ->选中以管理员身份运行此程序 ->好的 .

If you still get OSError: [WinError 740] The requested operation requires elevation try changing the tesseract executable to run as admin: Right Click tesseract.exe -> Properties -> Compability -> Check Run this program as an administrator -> OK .

这篇关于OSError: [WinError 740] 请求的操作需要提升的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆