From 20f604542e25cc598edae87e6013453e89099ac3 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sat, 23 Sep 2017 11:25:11 -0400 Subject: [PATCH] make python = 3 work Signed-off-by: Kenneth Reitz --- pipenv/cli.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/pipenv/cli.py b/pipenv/cli.py index d1e64bab..8f0b6d90 100644 --- a/pipenv/cli.py +++ b/pipenv/cli.py @@ -328,13 +328,21 @@ def find_a_system_python(python): elif os.path.isabs(python): return python else: - possibilities = reversed([ + possibilities = [ 'python', 'python{0}'.format(python[0]), - 'python{0}{1}'.format(python[0], python[2]), - 'python{0}.{1}'.format(python[0], python[2]), - 'python{0}.{1}m'.format(python[0], python[2]) - ]) + ] + if len(python) >= 2: + possibilities.extend( + [ + 'python{0}{1}'.format(python[0], python[2]), + 'python{0}.{1}'.format(python[0], python[2]), + 'python{0}.{1}m'.format(python[0], python[2]) + ] + ) + + # Reverse the list, so we find specific ones first. + possibilities = reversed(possibilities) for possibility in possibilities: # Windows compatibility.