diff --git a/news/5261.bugfix b/news/5261.bugfix new file mode 100644 index 0000000000..d30c2823cc --- /dev/null +++ b/news/5261.bugfix @@ -0,0 +1 @@ +Fix "The Python interpreter can't be found" error when running `pipenv install --system` with a python3 but no python. diff --git a/pipenv/utils/shell.py b/pipenv/utils/shell.py index 030fb19b2e..362290fae9 100644 --- a/pipenv/utils/shell.py +++ b/pipenv/utils/shell.py @@ -446,6 +446,7 @@ def project_python(project, system=False): python = project._which("python") else: interpreters = [system_which(p) for p in ("python", "python3")] + interpreters = [i for i in interpreters if i] # filter out not found interpreters python = interpreters[0] if interpreters else None if not python: click.secho("The Python interpreter can't be found.", fg="red", err=True)