我想在Python中實現OCR。當我運行下面的代碼:pytesser給出導入錯誤
from PIL import Image
from pytesser import *
image_file = 'menu.jpg'
im = Image.open(image_file)
text = image_to_string(im)
text = image_file_to_string(image_file)
text = image_file_to_string(image_file, graceful_errors=True)
print "=====output=======\n"
print text
我收到以下錯誤:
Traceback (most recent call last):
File "C:/Python27/ocr.py", line 2, in <module>
from pytesser import *
File "C:/Python27\pytesser.py", line 6, in <module>
ImportError: No module named Image
我在C:\Python27\Lib\site-packages
目錄中有一個文件夾的名稱pytesser
並在其中來自同一個目錄中名爲PIL
PILLOW的安裝。編號:Why can't Python import Image from PIL?我試過解決方案。但它似乎並沒有幫助
的可能的複製[爲什麼可以從PIL不能Python的導入圖像?](http://stackoverflow.com/questions/ 26505958/why-cant-python-import-image-from-pil) – Karin
謝謝。我嘗試了那裏提到的方法。但它沒有幫助。我猜pytesser與PIL整合有問題。但不知道。 –