Check_requirements() enclosing apostrophe bug fix (#2929)

This fixes a bug where the '>' symbol in python package requirements was not running correctly with subprocess.check_output() commands.
This commit is contained in:
Glenn Jocher 2021-04-25 23:33:25 +02:00 committed by GitHub
parent 9c7bb5a52c
commit 1849916726
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -117,8 +117,8 @@ def check_requirements(requirements='requirements.txt', exclude=()):
pkg.require(r) pkg.require(r)
except Exception as e: # DistributionNotFound or VersionConflict if requirements not met except Exception as e: # DistributionNotFound or VersionConflict if requirements not met
n += 1 n += 1
print(f"{prefix} {e.req} not found and is required by YOLOv5, attempting auto-update...") print(f"{prefix} {r} not found and is required by YOLOv5, attempting auto-update...")
print(subprocess.check_output(f"pip install {e.req}", shell=True).decode()) print(subprocess.check_output(f"pip install '{r}'", shell=True).decode())
if n: # if packages updated if n: # if packages updated
source = file.resolve() if 'file' in locals() else requirements source = file.resolve() if 'file' in locals() else requirements