我在终端中使用 Streamlit,即在终端中运行以下命令:
$ streamlit hello
我正在尝试使用在线教程创建应用程序但遇到错误 - 见下文
https://docs.streamlit.io/en/latest/tutorial/create_a_data_explorer_app.html#let-s-put-it-all-together
我已将以下内容保存为 uber_pickups.py
import streamlit as st
import pandas as pd
import numpy as np
st.title('Uber pickups in NYC')
(base) lf-mac-0250:~ alastairhayes$ streamlit hello
You can now view your Streamlit app in your browser.
Local URL: http://localhost:8501
Network URL: http://172.20.10.2:8501
^C
正在停止...
(base) lf-mac-0250:~ alastairhayes$ streamlit run uber_pickups.py
Usage: streamlit run [OPTIONS] TARGET [ARGS]...
Error: Invalid value: File does not exist: uber_pickups.py
我哪里错了? 我有 python 3.7.6 非常感谢!
最佳答案
如果您使用的是 Windows 操作系统,您可以尝试以下步骤:
首先,您需要下载 Anaconda: https://www.anaconda.com/
打开 Anaconda PowerShell 提示符并键入以下内容:
conda 列表
pip 卸载 streamlit
然后,创建一个新环境,并测试以下内容:
pip 安装 streamlit
streamlit 你好
最后,您可以在您的代码上测试 streamlit,将 your_app 替换为您文件的实际名称。确保您与源代码文件位于同一目录中。
streamlit run your_app.py
关于python - 为什么 Streamlit 找不到我的 python 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62323872/