{"id":23108976,"url":"https://github.com/licyk/term-sd","last_synced_at":"2025-08-16T18:32:07.095Z","repository":{"id":159174486,"uuid":"628247091","full_name":"licyk/term-sd","owner":"licyk","description":"Stable Diffusion 部署，管理脚本","archived":false,"fork":false,"pushed_at":"2024-12-09T09:34:57.000Z","size":2929,"stargazers_count":17,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-12-09T10:34:53.328Z","etag":null,"topics":["bash","install","manager","stable-diffusion"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/licyk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-15T11:02:21.000Z","updated_at":"2024-12-09T09:35:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"a50160c4-ca59-455b-8bec-9c612fe26aad","html_url":"https://github.com/licyk/term-sd","commit_stats":null,"previous_names":["licyk/sd-webui-scipt","licyk/term-sd"],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/licyk%2Fterm-sd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/licyk%2Fterm-sd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/licyk%2Fterm-sd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/licyk%2Fterm-sd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/licyk","download_url":"https://codeload.github.com/licyk/term-sd/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230048476,"owners_count":18164745,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","install","manager","stable-diffusion"],"created_at":"2024-12-17T01:32:08.387Z","updated_at":"2025-08-16T18:32:07.084Z","avatar_url":"https://github.com/licyk.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# Term-SD\n\n_✨一个小巧，多功能的 AI 软件管理器_\n\n\u003c/div\u003e\n\n- [Term-SD](#term-sd)\n- [概述](#概述)\n- [安装要求](#安装要求)\n- [配置运行环境](#配置运行环境)\n  - [Windows](#windows)\n    - [1. 安装 Microsoft Visual C++ Redistributable](#1-安装-microsoft-visual-c-redistributable)\n    - [2. 安装 MSYS2](#2-安装-msys2)\n    - [3. 配置 Windows 终端](#3-配置-windows-终端)\n    - [4. 配置 MSYS2 镜像源](#4-配置-msys2-镜像源)\n    - [5. 安装 Git，Dialog，Curl，Aria2](#5-安装-gitdialogcurlaria2)\n    - [6. 安装 Python，Pip](#6-安装-pythonpip)\n  - [Linux](#linux)\n    - [Debian / Ubuntu 系](#debian--ubuntu-系)\n    - [ArchLinux 系](#archlinux-系)\n    - [OpenSEUS](#openseus)\n    - [NixOS](#nixos)\n  - [MacOS](#macos)\n    - [1. 配置 Homebrew 镜像源](#1-配置-homebrew-镜像源)\n    - [2. 安装 Homebrew](#2-安装-homebrew)\n    - [3. 检测 Homebrew 是否安装成功](#3-检测-homebrew-是否安装成功)\n    - [4. 更新并应用镜像源](#4-更新并应用镜像源)\n    - [5. 安装依赖](#5-安装依赖)\n- [安装 Term-SD](#安装-term-sd)\n  - [1. 下载 Term-SD](#1-下载-term-sd)\n  - [2. 启动 Term-SD](#2-启动-term-sd)\n- [帮助文档](#帮助文档)\n    - [《Windows 平台如何配置 Term-SD 运行环境》](#windows-平台如何配置-term-sd-运行环境)\n    - [《在 Linux 上使用 Python 版本管理器安装 Python》](#在-linux-上使用-python-版本管理器安装-python)\n    - [《Term-SD 界面操作方法》](#term-sd-界面操作方法)\n    - [《如何使用 Term-SD》](#如何使用-term-sd)\n\n***\n\n# 概述\nTerm-SD 是一款基于 Dialog 实现前端界面显示的 AI 管理器，支持安装，管理以下软件：\n- 1、[Stable-Diffusion-WebUI](https://github.com/AUTOMATIC1111/stable-diffusion-webui) / [Stable-Diffusion-WebUI-Forge](https://github.com/lllyasviel/stable-diffusion-webui-forge) / [stable-diffusion-webui-reForge](https://github.com/Panchovix/stable-diffusion-webui-reForge) / [Stable-Diffusion-WebUI-Forge-Classic](https://github.com/Haoming02/sd-webui-forge-classic) / [Stable-Diffusion-WebUI-AMDGPU](https://github.com/lshqqytiger/stable-diffusion-webui-amdgpu) / [SD.Next](https://github.com/vladmandic/automatic)\n- 2、[ComfyUI](https://github.com/comfyanonymous/ComfyUI)\n- 3、[InvokeAI](https://github.com/invoke-ai/InvokeAI)\n- 4、[Fooocus](https://github.com/lllyasviel/Fooocus)\n- 5、[lora-scripts](https://github.com/Akegarasu/lora-scripts)\n- 6、[kohya_ss](https://github.com/bmaltais/kohya_ss)\n\n***\n\n# 安装要求\n\nTerm-SD 支持在 Linux，Windows，MacOS 上运行，在使用 Term-SD 前先配置好依赖环境，以下是各个平台所需的依赖：\n- Windows：MSYS2，Aria2，Python，Pip，Git，Dialog，Curl，Visual C++ Runtime\n- Linux：Aria2，Python，Pip，Git，Dialog，Curl\n- MacOS：Homebrew，Aria2，Python，Pip，Git，Dialog，Rust，Cmake，Protobuf，Wget，Curl\n\n\u003e[!NOTE]  \n\u003ePython 的版本建议使用 3.9 ~ 3.11，推荐使用 3.10。这里推荐一些 Python 版本管理器。  \n\u003e1. [MicroMamba](https://mamba.readthedocs.io/en/latest/installation/micromamba-installation.html)\n\u003e2. [Pyenv](https://github.com/pyenv/pyenv)（Windows 系统上使用 [Pyenv-Win](https://github.com/pyenv-win/pyenv-win)）\n\u003e3. [MiniConda](https://docs.anaconda.com/free/miniconda/index.html)\n\u003e\n\u003e在 Linux 上安装指定版本的 Python 并不方便，所以可以用上面的 Python 版本管理器安装 Python，并在启动 Term-SD 时加上`--set-python-path`启动参数来指定 Python 的路径。  \n\u003e具体方法可参考该文档：[《在 Linux 上使用 Python 版本管理器安装 Python》](#在-linux-上使用-python-版本管理器安装-python)\n\n***\n\n# 配置运行环境\n\n## Windows\n\n_！Windows 平台可阅读图文版[《Windows 平台如何配置 Term-SD 运行环境》](#windows-平台如何配置-term-sd-运行环境)_\n\n### 1. 安装 Microsoft Visual C++ Redistributable\n\n下载 [Microsoft Visual C++ Redistributable](https://aka.ms/vs/17/release/vc_redist.x64.exe) 并安装。\n\n\u003e[!NOTE]  \n\u003e缺失 Microsoft Visual C++ Redistributable 可能会导致 PyTorch 无法正常调用 GPU，参考：[[Bug]: Missing requirement for VC_redist.x64.exe causes \"RuntimeError: Torch is not able to use GPU\" · Issue #16032 · AUTOMATIC1111/stable-diffusion-webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/16032)\n\n\n### 2. 安装 MSYS2\n\n下载 [MSYS2](https://github.com/msys2/msys2-installer/releases/download/2024-05-07/msys2-x86_64-20240507.exe) 安装包。  \n下载好后打开 MSYS2 安装包，打开后点击`Next`进入安装路径选择，点击`Browse`选择安装路径，选择好后点击`Next`进行安装。\n\n\n### 3. 配置 Windows 终端\n\n\u003e[!NOTE]  \n\u003eWindows10 需在开始菜单中找到 Micorsoft Store 并进入，搜索 [Windows Terminal](https://www.microsoft.com/store/productId/9N0DX20HK701?ocid=pdpshare) 进行安装。\n\n右键桌面或者文件管理器空的位置，点击`在终端中打开`，在标题栏点击向下的箭头，打开 Windows 终端设置，点击`添加新配置文件`。  \n在`名称`中填入`MSYS2 UCRT64`。  \n在`命令行`填入以下内容：\n\n```\nC:\\msys64\\msys2_shell.cmd -defterm -no-start -use-full-path -here -ucrt64 -shell bash\n```\n\n在`启动目录`勾选`使用父进程目录`。  \n在`图标`填入以下内容\n\n```\nC:\\msys64\\ucrt64.ico\n```\n\n\u003e[!NOTE]  \n\u003e`C:\\msys64`为 MSYS2 的安装目录，根据具体安装的目录修改。\n\n保存后生效，在标题栏点击向下的箭头就可以看到`MSYS2 UCRT64`，打开后就可以下载和运行 Term-SD（一定要用在 Windows 终端 配置好的 MSYS2 UCRT64 运行 Term-SD，PowerShell 和 CMD 是没法运行 Term-SD 的）。\n\n\u003e[!NOTE]  \n\u003eWindows 终端默认启动 PowerShell，如果想要启动时直接启动 MSYS2 UCRT64，可以在Windows 终端设置，`启动` -\u003e `默认配置文件`，将`Windows Powershell`改成`MSYS2 UCRT64`，这样每次打开 Windows 终端时默认就会打开 MSYS2 UCRT64，不过 MSYS2 UCRT64 并不兼容 PowerShell 或者 CMD 的命令。  \n\u003e不推荐使用 MSYS2 安装程序安装的 MSYS2 UCRT64 终端。\n\n\n### 4. 配置 MSYS2 镜像源\n\n配置好 Windows 终端后在 Windows 终端的顶栏菜单里找到`MSYS2 UCRT64`，打开  \n在 MSYS2 UCRT64 终端输入以下内容并回车。\n\n```bash\nsed -i \"s#https\\?://mirror.msys2.org/#https://mirrors.tuna.tsinghua.edu.cn/msys2/#g\" /etc/pacman.d/mirrorlist*\npacman -Sy\n```\n\n\n### 5. 安装 Git，Dialog，Curl，Aria2\n\n输入以下内容并回车，等待安装完成。\n\n```bash\nyes | pacman -S git mingw-w64-ucrt-x86_64-git-lfs dialog curl mingw-w64-ucrt-x86_64-aria2 mingw-w64-ucrt-x86_64-ca-certificates\n```\n\n\n### 6. 安装 Python，Pip\n\n这里提供两种方法进行安装。\n\n**方法1. 使用 Python 安装器**\n\n下载 [Python](https://www.python.org/ftp/python/3.10.11/python-3.10.11-amd64.exe) 安装包。  \n下载好后打开 Python 安装包，在安装界面点击`Customize installation`，然后点击`Next`，勾选`Add Python to environment variables`，再点击`Browse`，自己选择要安装的路径，选择好后点击`install`，等待安装完成。  \n安装结束后先不要关闭安装界面，先点击`Disable path length limit`（没有该选项时则不用理会），再退出。\n\n\u003e[!NOTE]  \n\u003e1. Python 安装器在安装 Python 时同时安装 Pip（安装选项中已默认勾选安装 Pip），所以不需要手动再去安装 Pip。  \n\u003e2. `Disable path length limit`为启用 Windows 系统的长路径支持，具体查看微软官方文档[《最大路径长度限制》](https://learn.microsoft.com/zh-cn/windows/win32/fileio/maximum-file-path-limitation)，之前已经在 Windows 系统中启用该功能之后，选项`Disable path length limit`将不会显示。\n\n**方法2. 使用命令安装**\n\n运行下面的命令下载 Python 并安装。\n\n```bash\nmkdir -p \"${HOME}/python310\" ; curl -L \"https://modelscope.cn/models/licyks/invokeai-core-model/resolve/master/pypatchmatch/cpython-3.10.15%2B20241008-x86_64-pc-windows-msvc-shared-install_only.tar.gz\" | tar -xzf - --strip-components=1 -C \"${HOME}/python310\"\n```\n\n此时 Python 将会安装到`${HOME}/python310`这个路径，在[启动 Term-SD](#2-启动-term-sd)这个步骤需要手动指定一下这个路径。\n\n```bash\n./term-sd.sh --set-python-path \"${HOME}/python310/python\"\n```\n\n完成上面的步骤后 Term-SD 的运行环境就配置好了，可以在下面的步骤[安装 Term-SD](#安装-term-sd)。\n\n\n## Linux\n\n### Debian / Ubuntu 系\n```bash\nsudo apt install python3 python3-pip python3-venv python3-tk git aria2 dialog curl\n```\n\n### ArchLinux 系\n```bash\nsudo pacman -S python3 python3-pip python3-venv tk git aria2 dialog curl\n```\n\n### OpenSEUS\n```bash\nsudo zypper install python3 python3-pip python-venvs python-tk git aria2 dialog curl\n```\n\n### NixOS\n```bash\nnix-env -i python311Full aria git dialog curl\n```\n\n\u003e[!IMPORTANT]  \n\u003e一些 Linux 发行版没法安装指定版本的 Python，导致 Python 版本不合适，造成 AI 软件运行出错，所以可以用[安装要求](#安装要求)部分推荐的 Python 版本管理器安装 Python，并在启动 Term-SD 时加上`--set-python-path`启动参数来指定 Python 的路径。  \n\u003e参考该教程：[《在 Linux 上使用 Python 版本管理器安装 Python》](#在-linux-上使用-python-版本管理器安装-python)\n\n完成上面的步骤后 Term-SD 的运行环境就配置好了，可以在下面的步骤[安装 Term-SD](#安装-term-sd)。\n\n\n## MacOS\n\n### 1. 配置 Homebrew 镜像源\n\n配置 [Homebrew 镜像源](https://mirrors.tuna.tsinghua.edu.cn/help/homebrew/) 的环境变量。\n\n```bash\nexport HOMEBREW_API_DOMAIN=\"https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api\"\nexport HOMEBREW_BOTTLE_DOMAIN=\"https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles\"\nexport HOMEBREW_BREW_GIT_REMOTE=\"https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git\"\nexport HOMEBREW_CORE_GIT_REMOTE=\"https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git\"\nexport HOMEBREW_PIP_INDEX_URL=\"https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple\"\n```\n\n\n### 2. 安装 Homebrew\n\n下载安装脚本并安装 [Homebrew](https://brew.sh/zh-cn/)（如果下载失败可以多试几次）。\n\n```bash\n/bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\"\n```\n下载成功后会自动进入安装程序，根据提示来安装，安装成功时将会提示`Next steps`，根据提示执行`- Run these commands in your terminal to add Homebrew to your PATH:`和`- Run these commands in your terminal to add the non-default Git remotes for Homebrew/brew and Homebrew/homebrew-core:`部分的命令。\n\n\n### 3. 检测 Homebrew 是否安装成功\n\n```bash\nbrew -v\n```\n\n能够正常输出 Homebrew 版本就说明安装成功。\n\n\n### 4. 更新并应用镜像源\n\n```bash\nbrew update\n```\n\n\u003e[!NOTE]  \n\u003e参考：  \n[《清华大学开源软件镜像站 Homebrew / Linuxbrew 镜像使用帮助》](https://mirrors.tuna.tsinghua.edu.cn/help/homebrew/)  \n[《Homebrew Documentation》](https://docs.brew.sh/Installation)\n\n\n### 5. 安装依赖\n\n安装 Git，Aria2，Dialog，Python，Rust，Cmake，Protobuf，Wget，Curl。\n\n```bash\nbrew install git aria2 dialog python@3.10 rust cmake protobuf wget curl\n```\n\n完成上面的步骤后 Term-SD 的运行环境就配置好了，可以在下面的步骤[安装 Term-SD](#安装-term-sd)。\n\n***\n\n# 安装 Term-SD\n## 1. 下载 Term-SD\n\n打开终端，输入以下命令下载 Term-SD。\n\n```bash\naria2c https://github.com/licyk/term-sd/raw/main/term-sd.sh \u0026\u0026 chmod +x term-sd.sh\n```\n\n如果下载失败可以打开科学上网，再输入刚才的指令，或者使用 Gitee 仓库地址下载。\n\n```bash\naria2c https://gitee.com/licyk/term-sd/raw/main/term-sd.sh \u0026\u0026 chmod +x term-sd.sh\n```\n\n\u003e[!NOTE]  \n\u003e1. term-sd.sh 文件所在路径决定了 Term-SD 安装路径和 Term-SD 安装 AI 软件的路径，所以要选好一个自己想要安装的路径再下载，当然也可以把 term-sd.sh 文件移到其他路径。  \n\u003e2. Term-SD 已支持修改 AI 软件的安装路径，可以在 Term-SD 的`Term-SD 设置` -\u003e `自定义安装路径`中设置，该功能的说明在[《如何使用Term-SD》](https://github.com/licyk/README-collection/blob/main/term-sd/README_how_to_use_term_sd.md)。\n\n\n## 2. 启动 Term-SD\n\n在终端输入以下命令启动 Term-SD。\n\n```bash\n./term-sd.sh\n```\n\n如果需要指定 Python 路径，则加上`--set-python-path \u003cPython 解释器路径\u003e`参数进行指定，例如。\n\n```bash\n./term-sd.sh --set-python-path \"${HOME}/python310/python\"\n```\n\n启动后等待安装 Term-SD 组件后即可正常使用。  \n可在启动 Term-SD 时加上`--quick-cmd`启动参数安装`term_sd`命令和`tsd`命令，使启动 Term-SD 更快捷。  \n更多信息请阅读[帮助文档](#帮助文档)。\n\n***\n\n# 帮助文档\n\n\u003ch3\u003e这里是有关 Term-SD 的使用方法文档。\u003c/h3\u003e\n\n### [《Windows 平台如何配置 Term-SD 运行环境》](https://github.com/licyk/README-collection/blob/main/term-sd/README_config_env.md)\n介绍 Windows 平台下如何配置 Term-SD 运行环境。\n\n### [《在 Linux 上使用 Python 版本管理器安装 Python》](https://github.com/licyk/README-collection/blob/main/term-sd/README_install_python_on_linux.md)\n介绍使用 Python 版本管理器安装指定版本的 Python。\n\n\u003e[!IMPORTANT]  \n\u003e如果使用 MicroMamba 安装 Python，可以参考详细配置 MicroMamba 的教程：[《配置 MicroMamaba 包管理器 - licyk的小窝》](https://licyk.netlify.app/2025/05/31/configure-micromamba)\n\n### [《Term-SD 界面操作方法》](https://github.com/licyk/README-collection/blob/main/term-sd/README_how_to_use_dialog.md)\n介绍 Term-SD 界面 (Dialog) 的操作方法。\n\n### [《如何使用 Term-SD》](./help/how_to_use_term_sd.md)\n介绍 Term-SD 的使用方法，包括安装，管理 AI 软件，和 Term-SD 一些功能的使用。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flicyk%2Fterm-sd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flicyk%2Fterm-sd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flicyk%2Fterm-sd/lists"}