YOLOv5-7.0训练过程中出现报错Example: export GIT_PYTHON_REFRESH=quiet

出现报错:

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 (logging level CRITICAL, displayed by default)
    - error|e|exception|raise|r|2: for a raised exception

Example:
    export GIT_PYTHON_REFRESH=quiet

是因为环境中没有安装git,解决:

方法一:在train.py文件中的import os后面加上

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

方法二:conda install git 

D:\target detection\yolov5-7.0\utils\general.py:34: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81. import pkg_resources as pkg Traceback (most recent call last): File "D:\target detection\yolov5-7.0\.venv\Lib\site-packages\git\__init__.py", line 296, in <module> refresh() ~~~~~~~^^ File "D:\target detection\yolov5-7.0\.venv\Lib\site-packages\git\__init__.py", line 287, in refresh if not Git.refresh(path=path): ~~~~~~~~~~~^^^^^^^^^^^ File "D:\target detection\yolov5-7.0\.venv\Lib\site-packages\git\cmd.py", line 860, 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(<full-path-to-git-executable>) 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 (logging 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 "D:\target detection\yolov5-7.0\train.py", line 66, in <module> GIT_INFO = check_git_info() File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.2032.0_x64__qbz5n2kfra8p0\Lib\contextlib.py", line 85, in inner return func(*args, **kwds) File "D:\target detection\yolov5-7.0\utils\general.py", line 350, in check_git_info import git File "D:\target detection\yolov5-7.0\.venv\Lib\site-packages\git\__init__.py", line 298, 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(<full-path-to-git-executable>) 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 (logging level CRITICAL, displayed by default) - error|e|exception|raise|r|2: for a raised exception Example: export GIT_PYTHON_REFRESH=quiet
最新发布
08-21
PS C:\Users\钱肖海\Desktop\yolov5-7.0> & D:/anaconda/envs/yolov5/python.exe c:/Users/钱肖海/Desktop/yolov5-7.0/train.py Traceback (most recent call last): File "D:\anaconda\envs\yolov5\lib\site-packages\git\__init__.py", line 296, in <module> refresh() File "D:\anaconda\envs\yolov5\lib\site-packages\git\__init__.py", line 287, in refresh if not Git.refresh(path=path): File "D:\anaconda\envs\yolov5\lib\site-packages\git\cmd.py", line 631, 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(<full-path-to-git-executable>) 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 (logging 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/钱肖海/Desktop/yolov5-7.0/train.py", line 66, in <module> GIT_INFO = check_git_info() File "D:\anaconda\envs\yolov5\lib\contextlib.py", line 75, in inner return func(*args, **kwds) File "c:\Users\钱肖海\Desktop\yolov5-7.0\utils\general.py", line 350, in check_git_info import git File "D:\anaconda\envs\yolov5\lib\site-packages\git\__init__.py", line 298, 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 - expl
06-11
C:\Users\hero\anaconda3\envs\pytorch\python.exe D:\yolov5-7.0\train.py Traceback (most recent call last): File "C:\Users\hero\anaconda3\envs\pytorch\Lib\site-packages\git\__init__.py", line 296, in <module> refresh() ~~~~~~~^^ File "C:\Users\hero\anaconda3\envs\pytorch\Lib\site-packages\git\__init__.py", line 287, in refresh if not Git.refresh(path=path): ~~~~~~~~~~~^^^^^^^^^^^ File "C:\Users\hero\anaconda3\envs\pytorch\Lib\site-packages\git\cmd.py", line 631, 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(<full-path-to-git-executable>) 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 (logging 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 "D:\yolov5-7.0\train.py", line 67, in <module> GIT_INFO = check_git_info() File "C:\Users\hero\anaconda3\envs\pytorch\Lib\contextlib.py", line 85, in inner return func(*args, **kwds) File "D:\yolov5-7.0\utils\general.py", line 350, in check_git_info import git File "C:\Users\hero\anaconda3\envs\pytorch\Lib\site-packages\git\__init__.py", line 298, 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(<full-path-to-git-executable>) 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 (logging level CRITICAL, displayed by default) - error|e|exception|raise|r|2: for a raised exception Example: export GIT_PYTHON_REFRESH=quiet 进程已结束,退出代码为 1
05-23
YOLO系列是基于深度学习的端到端实时目标检测方法。 PyTorch版的YOLOv5轻量而高性能,更加灵活和易用,当前非常流行。 本课程将手把手地教大家使用labelImg标注和使用YOLOv5训练自己的数据集。课程实战分为两个项目:单目标检测(足球目标检测)和多目标检测(足球和梅西同时检测)。  本课程的YOLOv5使用ultralytics/yolov5,在Windows和Ubuntu系统上分别做项目演示。包括:安装YOLOv5、标注自己的数据集、准备自己的数据集(自动划分训练集和验证集)、修改配置文件、使用wandb训练可视化工具、训练自己的数据集、测试训练出的网络模型和性能统计。 除本课程《YOLOv5实战训练自己的数据集(Windows和Ubuntu演示)》外,本人推出了有关YOLOv5目标检测的系列课程。请持续关注该系列的其它视频课程,包括:《YOLOv5(PyTorch)目标检测:原理与源码解析》课程链接:https://edu.csdn.net/course/detail/31428《YOLOv5目标检测实战:Flask Web部署》课程链接:https://edu.csdn.net/course/detail/31087YOLOv5(PyTorch)目标检测实战:TensorRT加速部署》课程链接:https://edu.csdn.net/course/detail/32303《YOLOv5目标检测实战:Jetson Nano部署》课程链接:https://edu.csdn.net/course/detail/32451《YOLOv5+DeepSORT多目标跟踪与计数精讲》课程链接:https://edu.csdn.net/course/detail/32669《YOLOv5实战口罩佩戴检测》课程链接:https://edu.csdn.net/course/detail/32744《YOLOv5实战中国交通标志识别》课程链接:https://edu.csdn.net/course/detail/35209 《YOLOv5实战垃圾分类目标检测》课程链接:https://edu.csdn.net/course/detail/35284  
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值