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

运行streamlit命令提示‘streamlit未被识别’的问题及解决方法

Streamlit已安装但命令不被识别的解决办法

PS C:\Users\Project\ML\RAG> streamlit run .\model.py
streamlit : The term 'streamlit' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1

  • streamlit run .\model.py
  • + CategoryInfo          : ObjectNotFound: (streamlit:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    

以下是可行的解决步骤:

  • 添加Python Scripts路径到环境变量
    找到Python安装目录下的Scripts文件夹(示例路径:C:\Users\你的用户名\AppData\Local\Programs\Python\PythonXX\Scripts,XX为具体版本号),将该路径添加到系统环境变量PATH中。添加完成后重启PowerShell或终端,再执行streamlit run .\model.py命令。

  • 通过Python模块方式执行
    直接使用python -m streamlit run .\model.py命令运行(若系统中同时存在Python2,需替换为python3 -m streamlit run .\model.py),这种方式无需依赖环境变量配置。

  • 激活虚拟环境(若使用)
    如果项目使用了虚拟环境,先执行激活命令(示例:.\venv\Scripts\activate),激活后再运行Streamlit命令——虚拟环境内安装的包不会全局生效,必须激活环境才能调用。

  • 重新安装Streamlit(指定用户目录)
    执行pip install --user streamlit命令重新安装,该命令会将Streamlit安装到用户专属的Scripts目录,此目录通常已默认加入系统环境变量。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.25 05:40:07