ModuleNotFoundError:没有名为“streamlit.cli”的模块

Jim*_* Ya 7 python heroku streamlit

我在 Heroku 上部署 Streamlit 应用程序时遇到错误。我该如何应对?

像这样的错误

小智 10

当您从不同的文件夹安装多个 Streamlit 软件包时,例如克隆项目并在全局环境中安装它们的要求时,就会发生这种情况。在这种情况下,最好的办法是卸载系统中存在的 Streamlit 依赖项:

pip uninstall streamlit
Run Code Online (Sandbox Code Playgroud)

使用再次安装它,

pip install streamlit
Run Code Online (Sandbox Code Playgroud)

它应该消除所有冲突,并且您的应用程序现在应该可以运行。并记住在虚拟环境中安装新的要求,如果您在全局环境中安装所有要求,则会发生冲突。

然后只需使用以下命令运行streamlit run命令

streamlit run app.py
Run Code Online (Sandbox Code Playgroud)

现在一切都应该正常。


noo*_*bie 6

尝试升级streamlit(这对我有用)

pip install --upgrade streamlit
Run Code Online (Sandbox Code Playgroud)

否则重新安装

pip uninstall streamlit
pip install streamlit
Run Code Online (Sandbox Code Playgroud)


小智 1

您需要执行以下步骤:

  1. 创建虚拟环境。
  2. 激活虚拟环境。
  3. 然后,您需要安装以下软件包:
pip install streamlit
pip install networkx
Run Code Online (Sandbox Code Playgroud)

在运行之前,您还可以安装运行脚本所需的任何其他依赖项:

streamlit run yourscript.py
Run Code Online (Sandbox Code Playgroud)