Переглянути джерело

Improved `check_requirements()` offline-handling (#3466)

Improve robustness of `check_requirements()` function to offline environments (do not attempt pip installs when offline).
modifyDataloader
Glenn Jocher GitHub 3 роки тому
джерело
коміт
317f2ccc9d
Не вдалося знайти GPG ключ що відповідає даному підпису Ідентифікатор GPG ключа: 4AEE18F83AFDEB23
1 змінених файлів з 2 додано та 1 видалено
  1. +2
    -1
      utils/general.py

+ 2
- 1
utils/general.py Переглянути файл

@@ -163,10 +163,11 @@ def check_requirements(requirements='requirements.txt', exclude=()):
try:
pkg.require(r)
except Exception as e: # DistributionNotFound or VersionConflict if requirements not met
n += 1
print(f"{prefix} {r} not found and is required by YOLOv5, attempting auto-update...")
try:
assert check_online(), f"'pip install {r}' skipped (offline)"
print(check_output(f"pip install '{r}'", shell=True).decode())
n += 1
except Exception as e:
print(f'{prefix} {e}')


Завантаження…
Відмінити
Зберегти