From 8792c6d432865f772582a0d0d6b015463c05096a Mon Sep 17 00:00:00 2001 From: HairlessVillager <64526732+HairlessVillager@users.noreply.github.com> Date: Mon, 6 May 2024 17:04:38 +0800 Subject: [PATCH] Add a windows path in `_get_executable_path()` --- jedi/api/environment.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/jedi/api/environment.py b/jedi/api/environment.py index 771a9a83b..758917997 100644 --- a/jedi/api/environment.py +++ b/jedi/api/environment.py @@ -373,10 +373,13 @@ def _get_executable_path(path, safe=True): """ if os.name == 'nt': - python = os.path.join(path, 'Scripts', 'python.exe') + pythons = [os.path.join(path, 'Scripts', 'python.exe'), os.path.join(path, 'python.exe')] + else: + pythons = [os.path.join(path, 'bin', 'python')] + for python in pythons: + if os.path.exists(python): + break else: - python = os.path.join(path, 'bin', 'python') - if not os.path.exists(python): raise InvalidPythonEnvironment("%s seems to be missing." % python) _assert_safe(python, safe)