gpt4 book ai didi

python - 操作系统错误 : [WinError 740] The requested operation requires elevation

转载 作者:行者123 更新时间:2023-12-03 07:41:26 43 4
gpt4 key购买 nike

我有一个简单的代码,它有一个名为“try.png”的图像,我想使用 pytesseract 将它从图像转换为文本,但我遇到了一些代码问题。

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

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

最佳答案

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

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

如果您仍然收到 OSError: [WinError 740] The requested operation requires elevation尝试更改 tesseract 可执行文件以管理员身份运行:Right Click tesseract.exe -> Properties -> Compability -> Check Run this program as an administrator -> OK .

关于python - 操作系统错误 : [WinError 740] The requested operation requires elevation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62245083/

43 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com