'Tesseract not working in python but does in cmd

I have installed tesseract-OCR and also added to path and if I try to check the version in the cmd it works.

CMD Tesseract version command

I also tried to use python on the cmd to see if pytesseract works fine and it seems to be working

CMD Python tesseract import

but if I import it in a python script it can't find tesseract

Error message in python script



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source