From 7690671ea1e9be18d5a0d78abe3c401079e8e29c Mon Sep 17 00:00:00 2001 From: Daniel Simon Date: Thu, 18 Oct 2018 18:30:52 +0200 Subject: [PATCH] Fix _pyversion if include dir contains other files --- pipenv/project.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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}