diff --git a/src/one_dragon/envs/python_service.py b/src/one_dragon/envs/python_service.py index 1f0b52af..48d9b6eb 100644 --- a/src/one_dragon/envs/python_service.py +++ b/src/one_dragon/envs/python_service.py @@ -63,8 +63,11 @@ def is_virtual_python(self) -> bool: 是否虚拟环境的python :return: """ - env = os.environ - return 'VIRTUAL_ENV' in env or 'CONDA_PREFIX' in env + is_virtual_str = cmd_utils.run_command([self.env_config.python_path, "-c", "import sys; print(getattr(sys, 'base_prefix', sys.prefix) != sys.prefix)"]) + if is_virtual_str is None: + return False + else: + return is_virtual_str == 'True' def install_default_pip(self, progress_callback: Optional[Callable[[float, str], None]] = None) -> bool: """ diff --git a/src/one_dragon/gui/view/install_interface.py b/src/one_dragon/gui/view/install_interface.py index 000dddec..734836dc 100644 --- a/src/one_dragon/gui/view/install_interface.py +++ b/src/one_dragon/gui/view/install_interface.py @@ -57,11 +57,10 @@ def get_content_widget(self) -> QWidget: update_group.addSettingCard(self.venv_opt) v_layout.addWidget(update_group) - log_group = SettingCardGroup(gt('安装日志', 'ui')) - self.log_card = LogDisplayCard() - log_group.addSettingCard(self.log_card) v_layout.addWidget(log_group) + self.log_card = LogDisplayCard() + v_layout.addWidget(self.log_card, stretch=1) return content_widget diff --git a/src/one_dragon/utils/cmd_utils.py b/src/one_dragon/utils/cmd_utils.py index 1bcb261e..fcfada67 100644 --- a/src/one_dragon/utils/cmd_utils.py +++ b/src/one_dragon/utils/cmd_utils.py @@ -66,6 +66,7 @@ def run_command(commands: List[str], cwd: Optional[str] = None, else: return None except Exception: + log.error("执行命令失败", exc_info=True) return None