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

运行Python代码提示找不到langchain_community库,环境正常仍报错求助

问题:ModuleNotFoundError: No module named 'langchain_community'
  • 环境配置:Python 3.12.2,WSL2下的Ubuntu-22.04系统,使用PyCharm开发并已关联该WSL环境,虚拟环境处于激活状态
  • 当前进度:跟随LangChain入门教程学习到Retrieval Chain章节,使用ollama本地运行代码
  • 运行报错:执行main.py时出现如下错误:

Traceback (most recent call last):
File "/home/myUser/repos/python/myFirstProject/main.py", line 1, in
from langchain_community.llms import Ollama
ModuleNotFoundError: No module named 'langchain_community'

  • 已完成的排查操作:
    • 执行pip list确认已安装langchain-community(版本0.0.29)及相关LangChain系列包,列表如下:
      包名称版本
      其他包...x.x.x
      langchain0.1.13
      langchain-cli0.0.21
      langchain-community0.0.29
      langchain-core0.1.34
      langchain-text-splitters0.0.1
      langserve0.0.51
      langsmith0.1.33
      其他包...x.x.x
    • 确认所有相关包都存放在虚拟环境的.venv/include/lib/python3.12/site-packages目录中
    • 检查PyCharm的file -> settings -> Project:myProjectName -> Python Interpreter配置,解释器版本正确,已安装包列表完整
    • 尝试重装所有相关包,但问题未解决

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.26 22:42:21