No module named tesseract

北战南征 提交于 2020-01-15 05:28:06

问题


Working on an OCR. I can import pytesseract and use image_to_string but I want to work on this:

api = tesseract.TessBaseAPI()
api.SetVariable("tessedit_char_whitelist", "0123456789")
api.Init('.','eng',tesseract.OEM_DEFAULT)
api.SetPageSegMode(tesseract.PSM_AUTO)

This is to set tesseract to detect only numbers or alphabets. When I run my code I get this error:

ImportError: No module named tesseract

I have tesseract-ocr installed, and pytesseract as well. Yet I keep getting this error.


回答1:


I ran into this problem while trying to run pytesseract in Pycharm. Make sure you have an environmental path var to the Tesseract folder. This way the program knows to use the tesseract.exe from the installed location.

This is what my path looks like:




回答2:


You can install tesseract by using below command

pip install tesseract


来源:https://stackoverflow.com/questions/42369652/no-module-named-tesseract

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!