Skip to content

Commit 11f3262

Browse files
Update the logic of finding python interpreter (#1631)
* Change the precedence of finding python interpreter * Add changelog * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update logic * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update logic * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent e8cfe05 commit 11f3262

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

changelog.d/1521.bugfix.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update the logic of finding python interpreter such that `--fetch-missing-python` works on Windows

src/pipx/interpreter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ def find_python_interpreter(python_version: str, fetch_missing_python: bool = Fa
9797
if py_executable:
9898
return py_executable
9999
except (subprocess.CalledProcessError, FileNotFoundError) as e:
100-
raise InterpreterResolutionError(source="py launcher", version=python_version) from e
100+
if not fetch_missing_python and not FETCH_MISSING_PYTHON:
101+
raise InterpreterResolutionError(source="py launcher", version=python_version) from e
101102

102103
if fetch_missing_python or FETCH_MISSING_PYTHON:
103104
try:

0 commit comments

Comments
 (0)