当前位置:   article > 正文

YOLOv5运行错误:ImportError: Failed to initialize: Bad git executable.

importerror: failed to initialize: bad git executable. the git executable mu

问题描述:我们在跑YOLOv5官方数据集时,出现这个错误,ImportError: Failed to initialize: Bad git executable.

具体错误如下

  1. ImportError: Failed to initialize: Bad git executable.
  2. The git executable must be specified in one of the following ways:
  3. - be included in your $PATH
  4. - be set via $GIT_PYTHON_GIT_EXECUTABLE
  5. - explicitly set via git.refresh()
  6. All git commands will error until this is rectified.
  7. This initial warning can be silenced or aggravated in the future by setting the
  8. $GIT_PYTHON_REFRESH environment variable. Use one of the following values:
  9. - quiet|q|silence|s|none|n|0: for no warning or exception
  10. - warn|w|warning|1: for a printed warning
  11. - error|e|raise|r|2: for a raised exception
  12. Example:
  13. export GIT_PYTHON_REFRESH=quiet

具体原因:未知

解决办法:

在train.py文件中的import os后面加上

os.environ["GIT_PYTHON_REFRESH"] = "quiet"

具体位置

  1. import argparse
  2. import math
  3. import os
  4. os.environ["GIT_PYTHON_REFRESH"] = "quiet"
  5. import random
  6. import subprocess
  7. import sys
  8. import time
  9. from copy import deepcopy
  10. from datetime import datetime
  11. from pathlib import Path

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小丑西瓜9/article/detail/507555
推荐阅读
相关标签
  

闽ICP备14008679号