python pytesseract

python下没能成功安装pytesseract库

跑到在Mac下用brew安装tesseract,想绕一下让python调用shell进行图片识别

于是安装:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install tesseract

使用

tesseract test.png output
8C8E77C0-624F-475C-87E4-9F1C5A4238FB.png
tesseract test.png output
4AA9DF51-CC98-4B6C-99DB-695D99F21074.png

哈哈,成功

然后..........................

不甘心python不能直接使用
于是再跑了一遍

sudo pip install pytesseract
# ocr图像识别
def ocr(img):
    img = Image.open(img)
    img.show()
    rs = pytesseract.image_to_string(img)
    print('测试'+rs)
    return rs

额,竟然可以使用了

安装pytesseract依赖tesseract吗????

你可能感兴趣的:(python pytesseract)