python - 问题运行 streamlit hello
问题描述
尝试streamlit hello
在 anaconda 提示窗口中运行命令时遇到以下错误。我使用它安装了它pip install streamlit
,一切正常。关于为什么这不起作用的任何想法?我的 PC 是新的并运行 Windows 10,我在编码程序方面执行的唯一安装是 Anaconda。我没有单独安装python。
错误信息:
(base) C:\Users\matte>streamlit hello
Traceback (most recent call last):
File "c:\users\matte\anaconda3\lib\site-packages\git\__init__.py", line 83, in <module>
refresh()
File "c:\users\matte\anaconda3\lib\site-packages\git\__init__.py", line 73, in refresh
if not Git.refresh(path=path):
File "c:\users\matte\anaconda3\lib\site-packages\git\cmd.py", line 278, in refresh
raise ImportError(err)
ImportError: Bad git executable.
The git executable must be specified in one of the following ways:
- be included in your $PATH
- be set via $GIT_PYTHON_GIT_EXECUTABLE
- explicitly set via git.refresh()
All git commands will error until this is rectified.
This initial warning can be silenced or aggravated in the future by setting the
$GIT_PYTHON_REFRESH environment variable. Use one of the following values:
- quiet|q|silence|s|none|n|0: for no warning or exception
- warn|w|warning|1: for a printed warning
- error|e|raise|r|2: for a raised exception
Example:
export GIT_PYTHON_REFRESH=quiet
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "c:\users\matte\anaconda3\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\matte\anaconda3\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\matte\anaconda3\Scripts\streamlit.exe\__main__.py", line 4, in <module>
File "c:\users\matte\anaconda3\lib\site-packages\streamlit\cli.py", line 28, in <module>
import streamlit.bootstrap as bootstrap
File "c:\users\matte\anaconda3\lib\site-packages\streamlit\bootstrap.py", line 29, in <module>
from streamlit.server.server import Server, server_address_is_unix_socket
File "c:\users\matte\anaconda3\lib\site-packages\streamlit\server\server.py", line 39, in <module>
from streamlit.report_session import ReportSession
File "c:\users\matte\anaconda3\lib\site-packages\streamlit\report_session.py", line 26, in <module>
from streamlit.git_util import GitRepo
File "c:\users\matte\anaconda3\lib\site-packages\streamlit\git_util.py", line 1, in <module>
import git # type: ignore[import]
File "c:\users\matte\anaconda3\lib\site-packages\git\__init__.py", line 85, in <module>
raise ImportError('Failed to initialize: {0}'.format(exc)) from exc
ImportError: Failed to initialize: Bad git executable.
The git executable must be specified in one of the following ways:
- be included in your $PATH
- be set via $GIT_PYTHON_GIT_EXECUTABLE
- explicitly set via git.refresh()
All git commands will error until this is rectified.
This initial warning can be silenced or aggravated in the future by setting the
$GIT_PYTHON_REFRESH environment variable. Use one of the following values:
- quiet|q|silence|s|none|n|0: for no warning or exception
- warn|w|warning|1: for a printed warning
- error|e|raise|r|2: for a raised exception
Example:
export GIT_PYTHON_REFRESH=quiet
解决方案
基于此错误消息,我认为您需要在计算机上安装 git 和/或正确设置 $PATH
ImportError:错误的 git 可执行文件。git 可执行文件必须以下列方式之一指定: - 包含在您的 $PATH 中 - 通过 $GIT_PYTHON_GIT_EXECUTABLE 设置
推荐阅读
- rad-studio - 如何安装 Embarcadero RAD Studio 10.4 补丁?
- javascript - 从文件中获取 HTML 标记并附加到网站 HTML 标记
- php - PHP 从另一个函数调用函数
- javascript - 如何将带有箭头功能的 React 组件导入 app.js
- javascript - xml2js 可以在一个父节点下生成多个文本节点吗?
- mininet - 如何计算空闲和活动设备网络上的功耗(模拟)?
- jvm - JVM 生态系统 AOT 编译目前有哪些选项
- css - CSS Grid minmax - 需要验证,请
- javascript - 为什么它说“(函数)已定义但值从未被读取”?
- javascript - 为什么 text() 和样式。宽度在 Js 中不起作用?