Stable Diffusion 与 kohya_ss 安装配置指南
Stable Diffusion WebUI 和 kohya_ss 的详细安装流程。主要内容包括:使用 Conda 创建 Python 环境,克隆 GitHub 仓库,配置 webui-user.sh 及启动脚本;提供 uv 和 pip 两种 kohya_ss 安装方式;涵盖常见问题的解决方案,如缺失 python3-tk 依赖包以及 socks 协议代理配置。适合需要本地部署 AI 绘图工具的开发者参考。

Stable Diffusion WebUI 和 kohya_ss 的详细安装流程。主要内容包括:使用 Conda 创建 Python 环境,克隆 GitHub 仓库,配置 webui-user.sh 及启动脚本;提供 uv 和 pip 两种 kohya_ss 安装方式;涵盖常见问题的解决方案,如缺失 python3-tk 依赖包以及 socks 协议代理配置。适合需要本地部署 AI 绘图工具的开发者参考。

可以通过 GitHub 仓库下载 Automatic 1111。
# 创建名为 sd-webui 的环境(Python 3.10 推荐)
conda create -n sd-webui python=3.10 -y
# 激活环境
conda activate sd-webui
which python
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
cd stable-diffusion-webui
在 webui-user.sh 中添加以下内容(根据实际路径调整):
cp webui-user.sh webui-user.sh.bak
nano webui-user.sh
# 指定 Conda 环境的 Python 路径
python_cmd="/home/用户名/miniconda3/envs/sd-webui/bin/python"
# 禁用自动创建虚拟环境
venv_dir="-"
# 可选:添加启动参数
export COMMANDLINE_ARGS="--medvram --opt-split-attention"
按 Ctrl+O 保存,Ctrl+X 退出编辑器。
./webui.sh
终端将显示访问地址(通常为 http://127.0.0.1:7860),用户可通过浏览器直接使用。
安装完成后界面如下:

conda activate sd-webui
cd stable-diffusion-webui
./webui.sh
GitHub 仓库:https://github.com/bmaltais/kohya_ss
git clone --recursive https://github.com/bmaltais/kohya_ss.git
cd kohya_ss
./gui-uv.sh
git clone --recursive https://github.com/bmaltais/kohya_ss.git
cd kohya_ss
选项 A:使用系统 Python 或 venv
chmod +x setup.sh
./setup.sh
选项 B:使用 Conda 环境(推荐)
conda create -n kohyass python=3.11
conda activate kohyass
chmod +x setup.sh
./setup.sh
chmod +x gui.sh
./gui.sh
若看到 Running on http://0.0.0.0:7860,说明安装成功。

python3-tk 依赖包sudo apt update -y && sudo apt install -y python3-tk
socks 协议的代理 URL通过终端配置环境变量。
echo $SHELL
# bash 用户
nano ~/.bashrc
# zsh 用户
nano ~/.zshrc
export http_proxy="http://127.0.0.1:7897"
export https_proxy="http://127.0.0.1:7897"
# bash 用户
source ~/.bashrc
# zsh 用户
source ~/.zshrc
nano gui.sh
在脚本最顶部添加以下内容(清除残留代理并强制设置):
#!/bin/bash
unset http_proxy https_proxy HTTP_PROXY HTTPS_PROXY all_proxy ALL_PROXY
export http_proxy="http://127.0.0.1:7890"
export https_proxy="http://127.0.0.1:7890"
重新运行 ./gui.sh。
出现以下输出表明运行成功:
* Running on local URL: http://127.0.0.1:7860
* To create a public link, set `share=True` in `launch()`.
^CKeyboard interruption in main thread... closing server.

微信公众号「极客日志」,在微信中扫描左侧二维码关注。展示文案:极客日志 zeeklog
使用加密算法(如AES、TripleDES、Rabbit或RC4)加密和解密文本明文。 在线工具,加密/解密文本在线工具,online
生成新的随机RSA私钥和公钥pem证书。 在线工具,RSA密钥对生成器在线工具,online
基于 Mermaid.js 实时预览流程图、时序图等图表,支持源码编辑与即时渲染。 在线工具,Mermaid 预览与可视化编辑在线工具,online
解析常见 curl 参数并生成 fetch、axios、PHP curl 或 Python requests 示例代码。 在线工具,curl 转代码在线工具,online
将字符串编码和解码为其 Base64 格式表示形式即可。 在线工具,Base64 字符串编码/解码在线工具,online
将字符串、文件或图像转换为其 Base64 表示形式。 在线工具,Base64 文件转换器在线工具,online