Procházet zdrojové kódy

Added `YOLOv5_AUTOINSTALL` environment variable (#7505)

* Added a way to skip dependency auto-installation.

Setting the environment variable `YOLOv5_AUTOINSTALL=False` will
skip installing any missing dependencies as if the user had passed
`install=False` to `check_requirements`.

* Cleanup

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
modifyDataloader
Joseph Kocherhans GitHub před 2 roky
rodič
revize
b77c8d9d72
V databázi nebyl nalezen žádný známý klíč pro tento podpis ID GPG klíče: 4AEE18F83AFDEB23
1 změnil soubory, kde provedl 2 přidání a 1 odebrání
  1. +2
    -1
      utils/general.py

+ 2
- 1
utils/general.py Zobrazit soubor

@@ -40,6 +40,7 @@ FILE = Path(__file__).resolve()
ROOT = FILE.parents[1] # YOLOv5 root directory
DATASETS_DIR = ROOT.parent / 'datasets' # YOLOv5 datasets directory
NUM_THREADS = min(8, max(1, os.cpu_count() - 1)) # number of YOLOv5 multiprocessing threads
AUTOINSTALL = str(os.getenv('YOLOv5_AUTOINSTALL', True)).lower() == 'true' # global auto-install mode
VERBOSE = str(os.getenv('YOLOv5_VERBOSE', True)).lower() == 'true' # global verbose mode
FONT = 'Arial.ttf' # https://ultralytics.com/assets/Arial.ttf

@@ -338,7 +339,7 @@ def check_requirements(requirements=ROOT / 'requirements.txt', exclude=(), insta
pkg.require(r)
except Exception: # DistributionNotFound or VersionConflict if requirements not met
s = f"{prefix} {r} not found and is required by YOLOv5"
if install:
if install and AUTOINSTALL: # check environment variable
LOGGER.info(f"{s}, attempting auto-update...")
try:
assert check_online(), f"'pip install {r}' skipped (offline)"

Načítá se…
Zrušit
Uložit