Update main.py
Browse files
main.py
CHANGED
|
@@ -13,7 +13,27 @@ print('--------------远程执行---------------------')
|
|
| 13 |
import os
|
| 14 |
import subprocess
|
| 15 |
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
#SD插件下载
|
| 18 |
git_sd = [
|
| 19 |
'https://slink.ltd/https://github.com/2575044704/stable-diffusion-webui-localization-zh_CN2.git', #汉化
|
|
|
|
| 13 |
import os
|
| 14 |
import subprocess
|
| 15 |
|
| 16 |
+
|
| 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', #汉化
|