YOLOv5运行报错:SyntaxError: EOL while scanning string literal

一、错误详情

在运行YOLOv5模型中的detect.py文件时,出现如下报错:

YOLOv5运行报错:SyntaxError: EOL while scanning string literal_第1张图片

完整报错代码:

  File "C:\Projects\pythonProject\yolov5-5.0\detect.py", line 110
    with open(txt_path + '.txt', 'a') as f:
                                           ^
SyntaxError: EOL while scanning string literal

出现此问题是因为detect.py编码出现错误

二、解决方案

删掉文件最上方的两行代码,问题就可以解决了,可以进行检测。

# -*- coding : utf-8-*-
# coding:unicode_escape

YOLOv5运行报错:SyntaxError: EOL while scanning string literal_第2张图片

你可能感兴趣的:(YOLOv5笔记,python)