一、快速启动方案
提供预配置环境文件,包含模型及 Python 环境,下载解压后直接运行(需 NVIDIA 显卡支持)。
基础启动步骤
进入 Stable Diffusion WebUI 目录,激活 Python 虚拟环境并启动 WebUI。
# 进入目录
cd <WebUI 安装目录>/stable-diffusion-webui
# 激活虚拟环境
.venv\Scripts\activate.bat
# 启动 WebUI 并使用暗色主题
webui.bat --theme dark
批处理脚本优化
可创建 .bat 文件实现双击启动。内容如下:
@echo off
REM 进入 Stable Diffusion WebUI 目录
cd /d <WebUI 安装目录>\stable-diffusion-webui
REM 激活虚拟环境
call .venv\Scripts\activate.bat
REM 启动 WebUI 并使用暗色主题
call webui.bat --theme dark
REM 保持窗口打开
pause
二、手动克隆与配置
若需自行配置,请确保 Git 可用。
- 新建文件夹并拉取仓库:
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
- 安装 Python 环境,建议使用 uv 管理环境。
- 修改配置文件中的仓库地址(如需要):
# 示例:设置环境变量
import os
os.environ['STABLE_DIFFUSION_REPO'] = 'https://github.com/Stability-AI/stablediffusion.git'
三、运行与示例
启动成功后访问本地地址:http://127.0.0.1:7860/
文生图示例
将模型文件放入 models/Stable-diffusion 目录。
正面提示词: Beautiful anime girl, facing forward, long silky hair, big sparkling eyes, flawless skin, delicate facial features, gentle smile, wearing a stylish modern outfit, elegant pose with one hand slightly raised, soft lighting, vibrant colors, high detail, clean line art, sharp focus, subtle blush on cheeks, flowing hair, ethereal and charming atmosphere, cinematic composition
负面提示词: blurry, low quality, out of focus, bad anatomy, extra limbs, mutated, distorted face, poorly drawn, ugly expression, deformed hands, messy hair, text, watermark, pixelated, overexposed, underexposed, cartoonish, exaggerated features
注意:中文提示词效果可能受限,建议优先尝试英文提示词。


