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

Streamlit报错“Descriptors cannot be created directly”问题求助

解决Streamlit运行时“Descriptors cannot be created directly”错误

错误原因

这个错误核心原因是protobuf版本不兼容。Streamlit依赖特定版本的protobuf库,当环境中安装的protobuf版本过高(如≥4.21.0),就会触发描述符无法直接创建的问题。

修复步骤

  • 卸载当前环境中的protobuf:
    pip uninstall protobuf -y
    
  • 安装Streamlit兼容的指定版本protobuf(推荐3.20.x系列,示例用3.20.3):
    pip install protobuf==3.20.3
    
  • 用正确方式启动Streamlit脚本(不要直接用Sublime的运行按钮):
    streamlit run 你的脚本文件名.py
    

验证修复

执行以下命令确认protobuf版本:

pip show protobuf

输出中版本号显示为3.20.x即说明安装正确。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.02 05:30:46