简体   繁体   English

我不断收到 PermissionError: [WinError 5] Access is denied on Pytesserect

[英]I keep getting PermissionError: [WinError 5] Access is denied on Pytesserect

I know this has been answered but nothing works, I run my code我知道这已得到解答,但没有任何效果,我运行我的代码

import pytesseract
import cv2
pytesseract.pytesseract.tesseract_cmd = r"C:\\Users\\aidan\\AppData\\Local\\Tesseract-OCR"
image = cv2.imread(r'C:\Users\aidan\OneDrive\Desktop\download.jpg')
cv2.cvtColor(image,cv2.COLOR_BGR2RGB)
print(pytesseract.image_to_string(image))
cv2.imshow('Result',image)
cv2.waitKey()

and I always get this error我总是收到这个错误

[ WARN:0@0.043] global D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread_('download.jpg'): can't open/read file: check file path/integrity
Traceback (most recent call last):
  File "C:\Program Files\Python310\lib\subprocess.py", line 966, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Program Files\Python310\lib\subprocess.py", line 1435, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
PermissionError: [WinError 5] Access is denied

how can I fix this?我怎样才能解决这个问题?

You have dropped the executable in the cmd-variable:您已将可执行文件放入 cmd 变量中:

pytesseract.pytesseract.tesseract_cmd = r"C:\Users\aidan\AppData\Local\Tesseract-OCR\tesseract.exe"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM