mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
Actually filter out missing interpreters (#5262)
* Actually filter out missing interpreters This fixes https://github.com/pypa/pipenv/issues/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.
This commit is contained in:
committed by
GitHub
parent
f73a5ae407
commit
77bc74dce5
@@ -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...
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Fix "The Python interpreter can't be found" error when running ``pipenv install --system`` with a python3 but no python.
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user