diff --git a/poetry/console/commands/env/info.py b/poetry/console/commands/env/info.py
index 5f7f185419d..791c71a175c 100644
--- a/poetry/console/commands/env/info.py
+++ b/poetry/console/commands/env/info.py
@@ -33,8 +33,6 @@ def handle(self) -> Optional[int]:
self._display_complete_info(env)
def _display_complete_info(self, env: "Env") -> None:
- from poetry.utils.env import GenericEnv
-
env_python_version = ".".join(str(s) for s in env.version_info[:3])
self.line("")
self.line("Virtualenv")
@@ -60,7 +58,7 @@ def _display_complete_info(self, env: "Env") -> None:
self.line("")
- system_env = GenericEnv(env.base)
+ system_env = env.parent_env
self.line("System")
self.line(
"\n".join(
diff --git a/poetry/utils/env.py b/poetry/utils/env.py
index c9f3a780401..4a6f42291ac 100644
--- a/poetry/utils/env.py
+++ b/poetry/utils/env.py
@@ -762,7 +762,7 @@ def remove(self, python: str) -> "Env":
self.remove_venv(venv)
- return VirtualEnv(venv)
+ return VirtualEnv(venv, venv)
def create_venv(
self,
@@ -1741,6 +1741,21 @@ def get_paths(self) -> Dict[str, str]:
return json.loads(output)
+ def execute(self, bin: str, *args: str, **kwargs: Any) -> Optional[int]:
+ command = self.get_command_from_bin(bin) + list(args)
+ env = kwargs.pop("env", {k: v for k, v in os.environ.items()})
+
+ if not self._is_windows:
+ return os.execvpe(command[0], command, env=env)
+ else:
+ exe = subprocess.Popen([command[0]] + command[1:], env=env, **kwargs)
+ exe.communicate()
+
+ return exe.returncode
+
+ def _run(self, cmd: List[str], **kwargs: Any) -> Optional[int]:
+ return super(VirtualEnv, self)._run(cmd, **kwargs)
+
def is_venv(self) -> bool:
return self._path != self._base