1. If pytesseract is not installed in your virtual environment or your directories install it in your virtual environment or in your directorie by using the link: https://github.com/UB-Mannheim/tesseract/wiki or by running the command on your command prompt:
pip install pytesseract
2. Make sure that the tesseract path from default installation time is: ‘C:/Users/USER/AppData/Local/Tesseract-OCR’, or it may change. So carefully check the installation path and note it.
3. Set the tesseract path in the script before calling image_to_string by running commang:
pytesseract.pytesseract.tesseract_cmd = r‘C:/Users/USER/AppData/Local/Tesseract-OCR/tesseract.exe’