2017-08-20 65 views
0

我是Python新手。我正在嘗試創建一個Python OCR程序,並且正在爲它進行在線教程。這裏是我使用的推薦代碼:錯誤與PIL導入圖像和pytesser導入

from PIL import Image 
from pytesser import * 

image_file = 'menu.tif' 
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 

教程鏈接被發現here。但是,運行此代碼時出現此錯誤。

from pytesser import * 
ImportError: No module named 'pytesser' 

我按照說明書,從安裝OCR here和PyTesser庫這裏代碼(點)谷歌(點)的COM /存檔/ P/pytesser /下載(抱歉,因爲< 10代表我不能發佈超過2個鏈接)。 (pytesser_v0.0.1)是我的pytesser文件夾,在GitHub上找到了「tesseract-master」(可能不相關),而「tessinstall」也是我的安裝文件的截圖。是我安裝tesseract的文件夾,最後pyimgr.py是我嘗試運行的文件。

gyazo(點)的COM/333f8a3333e87895558f26875a8a8487

我之前還收到有關PIL導入圖像錯誤。我不應該使用PIL,那麼有沒有其他方式可以在沒有PIL的情況下導入圖像?也許枕頭?

我的Python版本3.5.2是,我使用的是Windows 10

回答

0

我的第一直覺是,你的庫安裝在Python不知道的地方。

import sys 
print sys.path 

如果你在Python中執行這些行,它會告訴你Python將在哪裏尋找蛋。 pytesser lib在那裏?

此外:作爲附註: pip3 search tesseract會向您展示其他一些tesseract Python軟件包。所以你可以使用Python包管理器。