yolov8运行出错及解决,No module named ‘ultralytics‘和ImportError: Failed to initialize: Bad git executable
成功解决 No module named 'ultralytics’和Failed to initialize: Bad git executable的问题,以此记录和分享。
文章共350字 · 阅读需要大约2分钟
一键AI生成摘要,助你高效阅读
问答
·
成功解决 No module named 'ultralytics’和Failed to initialize: Bad git executable的问题,以此记录和分享。
问题:
ModuleNotFoundError: No module named 'ultralytics'
解决:
在文件开头开间绝对路径,即ultralytics文件夹所在的文件夹路径。
问题:
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
解决:
在utils文件夹中的__init__.py的138行位置,即 import git 上方添加下面代码,即可解决。
os.environ["GIT_PYTHON_REFRESH"] = "quiet"
更多推荐
已为社区贡献11条内容
所有评论(0)