| 1114 | |
| 1115 | @property |
| 1116 | def all_env(self) -> List[PythonEnvironment]: |
| 1117 | venv_src_map = {} |
| 1118 | if self._all_env is None: |
| 1119 | self._all_env = [] |
| 1120 | for e in self.load_report()["environments"]: |
| 1121 | if not os.path.isfile(e["bin_path"]): # 文件已不存在的,就不在再展示 |
| 1122 | continue |
| 1123 | tmp_p = PythonEnvironment.from_dict(e) |
| 1124 | self._all_env.append(tmp_p) |
| 1125 | if tmp_p.env_type == "venv": |
| 1126 | venv_src_map[tmp_p.system_path] = tmp_p |
| 1127 | |
| 1128 | for tmp_p in self._all_env: |
| 1129 | if tmp_p.env_type == "system" and tmp_p.bin_path in venv_src_map: |
| 1130 | venv_src_map.pop(tmp_p.bin_path) |
| 1131 | |
| 1132 | for tmp_p in venv_src_map.values(): |
| 1133 | self._all_env.remove(tmp_p) |
| 1134 | |
| 1135 | return self._all_env |
| 1136 | |
| 1137 | def get_env_py_path(self, python_path: str) -> Optional[PythonEnvironment]: |
| 1138 | python_path = python_path.rstrip("/") |