How to install Pytesseract on Windows 8.1 (win64) (visual studio 2012 + python + anaconda)
from PIL import Image
from tesseract import image_to_string
print image_to_string(Image.open('C:\Users/Uzel/Desktop/pythonfoto/denklem.png'))
print image_to_string(Image.open('C:\Users/Uzel/Desktop/pythonfoto/denklem.png'), lang='eng')
I am using this code after installing tesseract orc.
Traceback (last call last): File "C: \ Users \ Uzel \ Documents \ Visual Studio 2012 \ Projects \ module3.py", line 28, in from import tesseract image_to_string ImportError: cannot import name image_to_string
I have this error. I tried pytesseract but I can't seem to get it right. Can we solve this problem. How? thank.
+3
source to share
1 answer
Below is a sample code with pytesseract
.
import pytesseract
from PIL import Image
pytesseract.pytesseract.tesseract_cmd = "C:/Program Files/Tesseract 4.0.0/tesseract.exe"
print(pytesseract.image_to_string(Image.open("./imagesStackoverflow/text.png"),
lang="eng",boxes=False,config="--psm 3 --eom 3"))
pytesseract.pytesseract.tesseract_cmd
- Explicitly specify the EXE path if the path was not configured correctly in Windows.
You need to install Tesseract on Windows and install pytesseract from Python.
Hope for this help.
+1
source to share