diff --git a/src/poetry/utils/env/python/manager.py b/src/poetry/utils/env/python/manager.py index f3eafc21605..afaac11774f 100644 --- a/src/poetry/utils/env/python/manager.py +++ b/src/poetry/utils/env/python/manager.py @@ -103,8 +103,9 @@ def get_active_python(cls) -> Python | None: for python in ShutilWhichPythonProvider().find_pythons(): return cls(python=python) - # fallback to findpython - if python := findpython.find(): + # fallback to findpython, restrict to finding only executables + # named "python" as the intention here is just that, nothing more + if python := findpython.find("python"): return cls(python=python) return None