(self)
| 491 | return None |
| 492 | |
| 493 | def remove(self) -> Optional[str]: |
| 494 | if self.env_type == "conda": |
| 495 | return "Conda环境不支持操作,请在命令行中执行conda remove -n {}".format(self.venv_name) |
| 496 | elif not self.bin_path.startswith(python_manager_path()) and \ |
| 497 | not self.bin_path.startswith(pyenv_path()): |
| 498 | return "非面板安装或创建的Python环境不支持操作,请手动处理" |
| 499 | try: |
| 500 | home = os.path.dirname(os.path.dirname(self.bin_path)) |
| 501 | public.print_log(os.path.isdir(home) and (home.startswith(python_manager_path()) or home.startswith(pyenv_path())), home) |
| 502 | if os.path.isdir(home) and (home.startswith(python_manager_path()) or home.startswith(pyenv_path())): |
| 503 | shutil.rmtree(home) |
| 504 | except: |
| 505 | return "删除失败" |
| 506 | |
| 507 | @property |
| 508 | def can_remove(self): |
no test coverage detected