【发布时间】:2020-07-07 00:34:13
【问题描述】:
我正在尝试在安装后运行 streamlit 应用程序(python 3.7.3)显示错误
streamlit hello
File "<ipython-input-2-c7a1b683aa76>", line 1
streamlit hello
^
SyntaxError: invalid syntax
【问题讨论】:
-
这是一个控制台命令。看起来您已经将它输入到 Python 解释器中。如果在命令行输入会发生什么?
-
我在 cmd 中显示 'streamlit hello 'streamlit' 未被识别为内部或外部命令、可运行程序或批处理文件。'
-
那是因为入门页面上的说明是针对 Linux 的,你想在 Windows 下运行它。 Windows 不会在文件中寻找 shebang 来发现如何运行它。它必须被告知。试试
python.exe path_to_streamlit\streamlit.py。如果您收到相同的错误消息,则还需要告知 Windows 您的 Python 解释器在哪里。类似C:...\python37\python.exe。 -
我通过升级 steamlit 和以前版本的 NumPy 来减缓这个问题