【问题标题】:Streamlit - Protocols cannot be instantiatedStreamlit - 无法实例化协议
【发布时间】:2022-10-16 11:16:47
【问题描述】:

我尝试运行一个简单的

import streamlit as st

st.write('Hello World')

它返回一个TypeError: Protocols cannot be instantiated. 发现一个类似的post 提到安装以前的版本,这导致了同样的错误。本地应用程序确实启动,但位于“请稍候...”屏幕上。

【问题讨论】:

  • 你的python版本是什么?
  • 同样的问题,在更新 streamlit 1.12.0,运行 python 3.9.7 后得到这个
  • 我也在 3.9.7
  • 您是否使用streamlit run <name of your Python file> 运行该应用程序?
  • 是的,我确认命令行的目录以及 .py 扩展名都是正确且存在的。

标签: python python-3.x streamlit


【解决方案1】:

我将我的 python 版本更新到 3.10,这解决了这个问题。显然 3.9.7 导致了这个issue

【讨论】:

    【解决方案2】:

    这实际上是 Python 3.9.7 的一个错误,开发人员以前没有遇到过,因为他们直到 streamlit 1.12.0 才使用 typing.Protocol。你应该更新你的python版本

    【讨论】:

      猜你喜欢
      • 2023-02-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-09-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-03
      相关资源
      最近更新 更多