zoukankan      html  css  js  c++  java
  • Mac Mojave 10.14.5安装python tesserocr

    <1>先安装两个依赖库:

    brew install tesseract

    brew install leptonica

    网上有些教程说要安装imagemagick,这里我觉得应该是不需要的,当然也可以用brew命令装上

    <2>下载tesserocr 离线包

    <3>将/usr/local/Cellar/路径下 leptonica/tesserocr头文件夹复制各一份到tesserocr setup.py路径下

    <4>将/usr/local/Cellar/路径下的 leptonica/tesserocr所有的库文件(.dylib)复制到anaconda3/lib/路径下

    <5>打开命令行安装tesserocr

    sudo CFLAGS="-mmacosx-version-min=10.14" python setup.py install

    <6>打开命令行出现错误,直接改正

    <7>show the demo

    #coding=utf-8
    #command line:export LC_ALL=C
    import locale
    locale.setlocale(locale.LC_ALL,'C')
    
    import tesserocr
    from PIL import Image
    image = Image.open('image.png')
    print(tesserocr.image_to_text(image))
  • 相关阅读:
    322. Coin Change
    368.[LeetCode] Largest Divisible Subset
    c++
    python 循环
    2018今日头条
    c++中set的用法
    [LeetCode]48. Rotate Image 旋转图片
    [LeetCode]47. Permutations II
    [LeetCode]46. Permutations
    sys与os模块(转载)
  • 原文地址:https://www.cnblogs.com/YangARTuan/p/11054441.html
Copyright © 2011-2022 走看看