-2
我只使用PIL,然後當我使用pytesser時它正常工作,那麼它不能正常工作。我該怎麼辦?pytesser不能在python中工作
from PIL import Image
from pytesser import *
image_file = Image.open("vote.jpg")
im = Image.open(image_file)
text = image_to_string(im)
print text
Traceback (most recent call last):
File "C:/Users/Tanvir/Desktop/py thon hand/hala.py", line 4, in <module>
image_file = Image.open("vote.jpg")
File "C:\Pythons27\lib\site-packages\PIL\Image.py", line 2286, in open
% (filename if filename else fp))
IOError: cannot identify image file 'vote.jpg'
錯誤消息似乎與pytesser無關。你確定你的圖片文件仍然在搜索路徑上嗎?如果你註釋掉'from pytesser import *'代碼是否工作? (如果沒有,那麼發生的事情就是vote.jpg)。你可以嘗試'import pytesser'而不是'from pytesser import *' – user1245262
我正在使用「import pytesser」,但它給了我一個錯誤,即「AttributeError:read」 – alibaba