【发布时间】:2018-09-15 17:42:11
【问题描述】:
我正在尝试将配置参数传递给 pytesseract 的 image_to_string 函数。
我运行的代码如下。
filename = 'address1_203.png'
img = Image.open(cam_img+filename)
ocr_out = ocr.image_to_string(img, lang='por', config='-psm 7')
print(ocr_out)
错误信息是
TypeError: image_to_string() got an unexpected keyword argument 'config'
stackoverflow 中还有另一个similar question,但我认为它不能解决我遇到的问题。
我通过 conda 使用conda install -c auto pytesseract 安装了 pytesseract
如果我删除 config 参数,代码就可以工作
P.S.:这是我发布的第一个问题,如果我做得正确,请给我反馈。谢谢=)
【问题讨论】:
-
-psm 7应该是--psm 7 -
谢谢。这种方式也不行。
-
this link 告诉 conda 有非常旧的 pytesseract 版本(v0.1),而当前版本是 v0.2.1。尝试按照pytesseract github page 中的说明使用 pip 安装
标签: python image python-imaging-library tesseract conda