运行yolov5的train.py时发生报错

运行yolov5的train.py时发生了一下报错

D:\anaconda3\envs\fruitAI1\python.exe D:\Yolov5s\fruit_1\train.py 
Traceback (most recent call last):
  File "D:\anaconda3\envs\fruitAI1\lib\site-packages\git\__init__.py", line 89, in <module>
    refresh()
  File "D:\anaconda3\envs\fruitAI1\lib\site-packages\git\__init__.py", line 76, in refresh
    if not Git.refresh(path=path):
  File "D:\anaconda3\envs\fruitAI1\lib\site-packages\git\cmd.py", line 392, 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 "D:\Yolov5s\fruit_1\train.py", line 72, in <module>
    GIT_INFO = check_git_info()
  File "D:\anaconda3\envs\fruitAI1\lib\contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "D:\Yolov5s\fruit_1\utils\general.py", line 360, in check_git_info
    import git
  File "D:\anaconda3\envs\fruitAI1\lib\site-packages\git\__init__.py", line 91, 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


Process finished with exit code 1

请问我该怎么才能解决这个问题。

要先装好git,并且配置好环境变量,你检查下吧
命令行输入一个 git -- version,如果没有执行或者报错,就是 git 没装好