功能修复:修复依赖时异常卡死

This commit is contained in:
li-xiaochen 2024-12-28 20:15:04 +08:00
parent 478bcd5f43
commit 5cdf9d752f

View file

@ -125,18 +125,24 @@ class Api:
os._exit(0) os._exit(0)
def rm_site_packages(self): def rm_site_packages(self):
site_packages_path = Path("./python/Lib/site-packages") try:
if site_packages_path.exists(): site_packages_path = Path("./python/Lib/site-packages")
rmtree(site_packages_path) if site_packages_path.exists():
return "site-packages目录移除成功" rmtree(site_packages_path)
return "python\\Lib\\site-packages目录不存在" return "site-packages目录移除成功"
return "python\\Lib\\site-packages目录不存在"
except Exception as e:
return repr(e)
def rm_python_scripts(self): def rm_python_scripts(self):
python_scripts_path = Path("./python/Scripts") try:
if python_scripts_path.exists(): python_scripts_path = Path("./python/Scripts")
rmtree(python_scripts_path) if python_scripts_path.exists():
return "Scripts目录移除成功" rmtree(python_scripts_path)
return "python\\Scripts目录不存在" return "Scripts目录移除成功"
return "python\\Scripts目录不存在"
except Exception as e:
return repr(e)
def run(self, command, cwd=None): def run(self, command, cwd=None):
command = command_list[command] command = command_list[command]