Yax-000 2024-02-25 00:47 采纳率: 0%
浏览 199
已结题

Yolov5训练报错

加载模型识别是可以正常用的,但是就是训练跑不起来报错如下,大家知道怎么处理嘛
Traceback (most recent call last):
File "F:\PY\envs\yolov5\lib\site-packages\git_init.py", line 140, in
refresh()
File "F:\PY\envs\yolov5\lib\site-packages\git_init
.py", line 127, in refresh
if not Git.refresh(path=path):
File "F:\PY\envs\yolov5\lib\site-packages\git\cmd.py", line 455, 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 message 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|silent|none|n|0: for no message or exception
- warn|w|warning|log|l|1: for a warning message (logged at level CRITICAL, displayed by default)
- error|e|exception|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\Administrator\Desktop\yolov5-master\train.py", line 72, in
GIT_INFO = check_git_info()
File "F:\PY\envs\yolov5\lib\contextlib.py", line 75, in inner
return func(*args, **kwds)
File "C:\Users\Administrator\Desktop\yolov5-master\utils\general.py", line 370, in check_git_info
import git
File "F:\PY\envs\yolov5\lib\site-packages\git_init_.py", line 142, in
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 message 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|silent|none|n|0: for no message or exception
- warn|w|warning|log|l|1: for a warning message (logged at level CRITICAL, displayed by default)
- error|e|exception|raise|r|2: for a raised exception

Example:
export GIT_PYTHON_REFRESH=quiet

进程已结束,退出代码为 1

  • 写回答

21条回答 默认 最新

  • 码农阿豪@新空间代码工作室 Java领域优质创作者 2024-02-25 00:47
    关注
    获得0.40元问题酬金
    让阿豪来帮你解答,本回答参考chatgpt3.5编写提供,如需一对一服务私聊我哦
    这个报错是由于git可执行文件未设置或设置错误导致的。解决方法是指定正确的git可执行文件路径或将其添加到$PATH环境变量中。 为了解决这个问题,可以按照以下步骤操作: 1.确定你的系统中已经正确安装了git。 2.设置git可执行文件路径,可以在代码中添加以下代码: import git git.refresh(default='path/to/your/git/executable') 3.将git可执行文件添加到$PATH环境变量中,可以在系统环境变量中添加你的git可执行文件所在的路径。 这是一个示例代码,设置了git可执行文件路径: import git def main():
    # 设置git可执行文件路径
    git.refresh(default="C:/Program Files/Git/cmd/git.exe")
    # 运行你的代码
    

    if name == 'main': main()

    评论

报告相同问题?

问题事件

  • 系统已结题 3月4日
  • 创建了问题 2月25日

悬赏问题

  • ¥30 基于信创PC发布的QT应用如何跨用户启动后输入中文
  • ¥20 非root手机,如何精准控制手机流量消耗的大小,如20M
  • ¥15 远程安装一下vasp
  • ¥15 自己做的代码上传图片时,报错
  • ¥15 Lingo线性规划模型怎么搭建
  • ¥15 关于#python#的问题,请各位专家解答!区间型正向化
  • ¥15 unity从3D升级到urp管线,打包ab包后,材质全部变紫色
  • ¥50 comsol温度场仿真无法模拟微米级激光光斑
  • ¥15 上传图片时提交的存储类型
  • ¥15 VB.NET如何绘制倾斜的椭圆