My code:
pytesseract.pytesseract.tesseract_cmd = 'C:/Programs/tesseract'
print(pytesseract.image_to_string(Image.open("test.png")))
I get the error: PermissionError: [WinError 5] Access is denied
I then ran the program as administrator, and received the same error. I also changed the permissions of the tesseract folder.
I installed pytesseract using the Python interpreter in Pycharm, and also downloaded the binary from Windows here, using the second option. I extracted the zip folder in C:\Programs
What is causing the error?
After spending few hours, I found the issue. I am using Win 10 with Python 3.6
img = Image.open('sample1.jpg')
pytesseract.pytesseract.tesseract_cmd = 'C:\\Program Files (x86)\\Tesseract-OCR\\tesseract.exe'
result = pytesseract.image_to_string(img)
tesseract.exe executable has to be appended to pytesseract.pytesseract.tesseract_cmd
fyi, earlier I also gave full rights to Tesseract-OCR folder but it may not be required
Are you sure this is the full path of your executable?
C:/Programs/tesseract
Because it looks like the path to the executable's folder. Check with the windows explorer what the full path of the executable is and put it in that line:
pytesseract.pytesseract.tesseract_cmd = 'C:/Programs/tesseract/tesseract.exe'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With