You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用LangChain调用Azure Document Intelligence报错:找不到‘azure’模块

解决"No module named 'azure'"错误的方案

针对运行LangChain的AzureAIDocumentIntelligenceLoader代码时出现的No module named 'azure'错误,可尝试以下方案:

  • 确认Python环境一致性
    检查当前运行代码的Python环境是否与安装依赖包的环境一致:

    • 在终端执行which python(Linux/macOS)或where python(Windows),获取当前Python解释器路径。
    • 执行pip list,查看该环境下是否存在azure-ai-documentintelligence、azure-core等已安装的包。若不存在,说明包安装到了其他环境,需切换到对应环境或重新安装。
  • 重新安装依赖包
    先卸载已安装的相关包,再重新安装最新版本:

    pip uninstall -y azure-ai-formrecognizer azure-ai-documentintelligence azure-core
    pip install azure-ai-documentintelligence
    

    注:azure-ai-documentintelligence会自动安装其依赖的azure-core,无需单独安装。

  • 检查导入语句正确性
    确保代码顶部的导入语句正确无误:

    from langchain.document_loaders import AzureAIDocumentIntelligenceLoader
    

    错误的导入路径可能间接引发模块找不到的问题。

  • 尝试安装azure元包(备选方案)
    若上述方案无效,可尝试安装旧版的azure元包(不推荐长期使用,仅用于排查问题):

    pip install azure
    

内容的提问来源于stack exchange,提问作者Ed Gonen

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.20 13:32:36