yolov5调试common.py出现importerror: cannot import name ‘tryexcept‘ from ‘utils‘

电脑不认识根目录路径,只要添加以下代码便可以解决:

import sys

import os

FILE = Path(__file__).resolve()

ROOT = FILE.parents[1]  # YOLOv5 root directory

if str(ROOT) not in sys.path:

    sys.path.append(str(ROOT))  # add ROOT to PATH

if platform.system() != 'Windows':

    ROOT = Path(os.path.relpath(ROOT, Path.cwd()))  # relative

你可能感兴趣的:(YOLO,python)