zoukankan      html  css  js  c++  java
  • python 文字 识别+python 错误: ModuleNotFoundError: No module named 'request'

    import request
    from aip import AipOcr

    image = requests.get('https://static.pandateacher.com/7b5d6d8d9dea5691705d04fef2306b52.png').content

    APP_ID = '11756541'
    API_KEY = '2YhkLuyQGljPUYnmi1CFgxOP'
    SECRET_KEY = '4rrHe2BF828bI8bQy6bLlx1MelXqa8Z7'

    client = AipOcr(APP_ID, API_KEY, SECRET_KEY)
    res = client.basicGeneral(image)
    if 'words_result' in res.keys():
    for item in res['words_result']:
    print(item['words'])
    else:
    print(res)

    结果:

    bash:38$ python ~/classroom/apps-1-id-5c3d88f08939b4000100e7d3/38/main.py
    优美胜于丑陋
    明了胜亍晦涩
    简法胜于复杂
    复杂胜于凌礼
    扁平胜于嵌套
    间隔胜亍紧凑

    如果运行第一句时出错:python 错误: ModuleNotFoundError: No module named 'requests'

    则需要进入cmd安装:pip3  install request

    安装成功之后再运行

  • 相关阅读:
    深入了解css的行高Line Height属性
    Kafka消息队列
    架构图
    清理肠道好方法
    维特根斯坦
    ES查询DSL大于小于写法
    python虚拟环境
    Dockerfile
    flask基本使用
    泛型类多个类型参数的定义
  • 原文地址:https://www.cnblogs.com/bzdmz/p/10323470.html
Copyright © 2011-2022 走看看