diff --git a/pipenv/project.py b/pipenv/project.py index a3e31bfd..c2dc9668 100644 --- a/pipenv/project.py +++ b/pipenv/project.py @@ -926,8 +926,8 @@ class Project(object): @property def _pyversion(self): include_dir = vistir.compat.Path(self.virtualenv_location) / "include" - python_path = next(iter(list(include_dir.iterdir())), None) - if python_path and python_path.name.startswith("python"): + python_path = next((x for x in include_dir.iterdir() if x.name.startswith("python")), None) + if python_path: python_version = python_path.name.replace("python", "") py_version_short, abiflags = python_version[:3], python_version[3:] return {"py_version_short": py_version_short, "abiflags": abiflags}