【发布时间】:2016-06-25 00:52:39
【问题描述】:
我正在尝试使用 teseract-OCR 对 python 中的图像文件进行 OCR。 我的环境是—— Windows 机器上的 Python 3.5 Anaconda。
代码如下:
from PIL import Image
from pytesseract import image_to_string
out = image_to_string(Image.open('sample.png'))
我得到的错误是:
File "Anaconda3\lib\sitepackages\pytesseract\pytesseract.py", line 167, in image_to_string
return f.read().strip()
File "Anaconda3\lib\encodings\cp1252.py", line 23 in decode
return codecs.charmap_decode(input, self.errors, decoding_table)[0]
UnicodeDecodeError:'charmap' codec can't decode byte 0x81 in position 1583: character maps to <undefined>
我已经尝试过here提到的解决方案 破解无效
我已经在 Mac OS 上尝试了我的代码,它可以正常工作。
我研究了 pytesseract 问题: 这是open issue
谢谢
【问题讨论】:
标签: python character-encoding tesseract python-tesseract