diff --git a/src/poetry/utils/env/env_manager.py b/src/poetry/utils/env/env_manager.py index 438dc7455f5..f8124f3bda0 100644 --- a/src/poetry/utils/env/env_manager.py +++ b/src/poetry/utils/env/env_manager.py @@ -237,6 +237,12 @@ def get(self, reload: bool = False) -> Env: prefer_active_python = self._poetry.config.get( "virtualenvs.prefer-active-python" ) + if prefer_active_python: + executable = self._detect_active_python() + bin_dir = executable.parent + path = bin_dir.parent + return VirtualEnv(path, Path(executable.name)) + python_minor = self.get_python_version( precision=2, prefer_active_python=prefer_active_python, io=self._io ).to_string()