From f380a5555728271f51ca10ed27779ae11069d5a4 Mon Sep 17 00:00:00 2001 From: Yoshihisa Mochihara Date: Thu, 13 Aug 2020 17:15:46 +0200 Subject: [PATCH] handle python major and minor version correctly in create_pipfile fix #4379 previous code cannot handle 3.XX --- pipenv/project.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pipenv/project.py b/pipenv/project.py index f3016d4036..8f5cb7a549 100644 --- a/pipenv/project.py +++ b/pipenv/project.py @@ -756,8 +756,8 @@ def create_pipfile(self, python=None): else: required_python = self.which("python") version = python_version(required_python) or PIPENV_DEFAULT_PYTHON_VERSION - if version and len(version) >= 3: - data[u"requires"] = {"python_version": version[: len("2.7")]} + if version and len(version.split(".")) > 2: + data[u"requires"] = {"python_version": ".".join(version.split(".")[:2])} self.write_toml(data) @classmethod