Qi28 commited on
Commit
9c62b8a
·
verified ·
1 Parent(s): 448b0dc

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +10 -9
main.py CHANGED
@@ -17,23 +17,24 @@ import subprocess
17
 
18
  def install_aria2():
19
  try:
20
- if 'ubuntu' in subprocess.check_output(['lsb_release', '-i']).decode().lower():
21
- subprocess.run(['sudo', 'apt-get', 'install', 'aria2', '-y'], check=True)
22
- elif 'centos' in subprocess.check_output(['cat', '/etc/redhat-release']).decode().lower():
23
- subprocess.run(['sudo', 'yum', 'install', 'aria2', '-y'], check=True)
24
- elif 'arch' in subprocess.check_output(['cat', '/etc/os-release']).decode().lower():
25
- subprocess.run(['sudo', 'pacman', '-S', 'aria2'], check=True)
26
- elif 'darwin' in subprocess.check_output(['uname']).decode().lower():
27
- subprocess.run(['brew', 'install', 'aria2'], check=True)
28
  else:
29
  print("无法自动检测您的操作系统,请手动安装 aria2。")
30
- except subprocess.CalledProcessError as e:
31
  print(f"安装 aria2 失败: {e}")
32
 
33
  # 使用
34
  install_aria2()
35
 
36
 
 
37
  #SD插件下载
38
  git_sd = [
39
  'https://slink.ltd/https://github.com/2575044704/stable-diffusion-webui-localization-zh_CN2.git', #汉化
 
17
 
18
  def install_aria2():
19
  try:
20
+ if 'ubuntu' in os.popen('lsb_release -i').read().lower():
21
+ os.system('sudo apt-get install aria2 -y')
22
+ elif 'centos' in os.popen('cat /etc/redhat-release').read().lower():
23
+ os.system('sudo yum install aria2 -y')
24
+ elif 'arch' in os.popen('cat /etc/os-release').read().lower():
25
+ os.system('sudo pacman -S aria2')
26
+ elif 'darwin' in os.popen('uname').read().lower():
27
+ os.system('brew install aria2')
28
  else:
29
  print("无法自动检测您的操作系统,请手动安装 aria2。")
30
+ except Exception as e:
31
  print(f"安装 aria2 失败: {e}")
32
 
33
  # 使用
34
  install_aria2()
35
 
36
 
37
+
38
  #SD插件下载
39
  git_sd = [
40
  'https://slink.ltd/https://github.com/2575044704/stable-diffusion-webui-localization-zh_CN2.git', #汉化