[英]How To Install Pytesseract in 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 use this code after installing tesseract orc. 我在安装tesseract orc后使用此代码。
Traceback (most recent call last): File "C:\\Users\\Uzel\\Documents\\Visual Studio 2012\\Projects\\module3.py", line 28, in from tesseract import image_to_string ImportError: cannot import name image_to_string 回溯(最近一次调用最后一次):文件“C:\\ Users \\ Uzel \\ Documents \\ Visual Studio 2012 \\ Projects \\ module3.py”,第28行,来自tesseract import image_to_string ImportError:无法导入名称image_to_string
I have this error. 我有这个错误。 I tried pytesseract but I can not manage.
我尝试了pytesseract,但我无法管理。 Can we solve this problem.
我们能解决这个问题吗? How?
怎么样? thank you.
谢谢。
Below is a sample code with pytesseract
. 下面是
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"))
The pytesseract.pytesseract.tesseract_cmd
is to specific the EXE path explicitly in case the path hasn't been properly set up in Windows environment. pytesseract.pytesseract.tesseract_cmd
将明确指定EXE路径,以防路径未在Windows环境中正确设置。
You need to have Tesseract installed in Windows and pytesseract installed with Python. 您需要在Windows中安装Tesseract,并在Python中安装pytesseract。
Hope this help. 希望这有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.