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

Streamlit报错AttributeError: module 'streamlit'无chat_input属性求助

解决Streamlit AttributeError: module 'streamlit' has no attribute 'chat_input' 问题

st.chat_input 是Streamlit 1.22.0及以上版本才支持的API,你标注使用1.33.0版本但仍报错,大概率是Python环境冲突导致实际调用的Streamlit版本不达标,按以下步骤排查修复:

  • 检查当前环境的真实Streamlit版本
    在终端执行命令,确认运行代码的环境里Streamlit的实际版本:

    python -c "import streamlit as st; print(st.__version__)"
    

    如果输出低于1.22.0,说明环境不匹配。

  • 升级/重装指定版本的Streamlit
    执行命令安装1.33.0版本,确保环境一致:

    pip install --upgrade streamlit==1.33.0 --force-reinstall
    

    若使用conda环境,替换为:

    conda install -c conda-forge streamlit=1.33.0 --force-reinstall
    
  • 确认运行环境正确
    如果你有多个Python环境(虚拟环境、conda环境等),必须在安装了1.33.0版本的环境中运行代码:

    • VS Code用户:右下角切换对应Python解释器;
    • 终端用户:先激活目标环境再执行代码,比如:
      # Windows虚拟环境激活
      venv\Scripts\activate
      # Mac/Linux虚拟环境激活
      source venv/bin/activate
      
  • 验证修复
    重新运行你的代码,st.chat_input 应该可以正常调用。


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.25 20:55:08