Skip to content

Commit

Permalink
Actually filter out missing interpreters (#5262)
Browse files Browse the repository at this point in the history
* Actually filter out missing interpreters

This fixes #5261.

Before this change, I would get a "The Python interpreter can't be
found" error when running `pipenv install --system` with a python3 but
no python.
  • Loading branch information
jfly authored Aug 16, 2022
1 parent f73a5ae commit 77bc74d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ How does this pull request fix your problem? Did you consider any alternatives?
### The checklist

* [ ] Associated issue
* [ ] A news fragment in the `news/` directory to describe this fix with the extension `.bugfix`, `.feature`, `.behavior`, `.doc`. `.vendor`. or `.trivial` (this will appear in the release changelog). Use semantic line breaks and name the file after the issue number or the PR #.
* [ ] A news fragment in the `news/` directory to describe this fix with the extension `.bugfix.rst`, `.feature.rst`, `.behavior.rst`, `.doc.rst`. `.vendor.rst`. or `.trivial.rst` (this will appear in the release changelog). Use semantic line breaks and name the file after the issue number or the PR #.

<!--
### If this is a patch to the `vendor` directory...
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Or, if you\'re using FreeBSD:
Or, if you\'re using Gentoo:

sudo emerge pipenv

Or, if you\'re using Void Linux:

sudo xbps-install -S python3-pipenv
Expand Down
1 change: 1 addition & 0 deletions news/5261.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix "The Python interpreter can't be found" error when running ``pipenv install --system`` with a python3 but no python.
1 change: 1 addition & 0 deletions pipenv/utils/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 77bc74d

Please sign in to comment.