Stable Diffusion WebUI 本地部署指南(Windows 11 + RTX 4060 Ti)

环境配置

  • 操作系统:Windows 11
  • 内存:32GB
  • GPU:NVIDIA RTX 4060 Ti (16GB)
  • Python 版本:3.10
  • CUDA 版本:12.1

一、准备工作

1. 安装必要工具

  • Git:用于克隆项目代码
  • Anaconda:用于创建和管理 Python 环境
  • NVIDIA 驱动:确保支持 CUDA 12.1+,建议安装最新版本

2. 创建 Python 环境

复制代码
# 创建名为sdenv的Python 3.10环境
conda create -n sdenv python=3.10 -y

# 激活环境
conda activate sdenv

二、下载 WebUI 项目

方法 1:使用 Git 克隆(推荐)

复制代码
# 克隆项目到当前目录
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git

# 进入项目目录
cd stable-diffusion-webui

方法 2:手动下载 Release 包

  1. 访问 Releases · AUTOMATIC1111/stable-diffusion-webui · GitHub
  2. 下载最新版本的 Source code (zip)
  3. 解压到任意目录,建议路径不含中文和特殊字符

三、安装依赖与配置环境

1. 设置 pip 镜像源(加速下载)

复制代码
# 设置清华镜像为默认源
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

# 添加阿里云镜像作为额外源
pip config set global.extra-index-url https://mirrors.aliyun.com/pypi/simple/

手动下载cuda依赖:

https://download.pytorch.org/whl/cu121/torch-2.1.2%2Bcu121-cp310-cp310-win_amd64.whl

进入虚拟环境后 pip install cu121-cp310-cp310-win_amd64.whl

复制代码
pip install torch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2

安装项目依赖

复制代码
# 安装requirements.txt中的所有依赖
pip install -r requirements.txt

四、启动 WebUI

使用 Python 命令启动

bash

复制代码
# 确保在虚拟环境中
python launch.py

五、访问 WebUI 界面

启动成功后,在浏览器中打开:

  • 本地访问:http://127.0.0.1:7860
  • 如需公网访问,添加--share参数启动:python launch.py --share

六、安装汉化包

方法:使用扩展安装

  1. 在 WebUI 中进入 Extensions 选项卡
  2. 点击 Install from URL
  3. 在输入框中填写:https://github.com/VinsonLaro/stable-diffusion-webui-chinese
  4. 点击 Install 按钮
  5. 安装完成后,在extensions-> install from url 里面填写 点击install之后 进入setting->user interface->User insterface, 勾选>
    Reload UI scripts when using Reload UI option
    (useful for developing: if you make changes to UI scripts code, it is applied when the UI is reloded.)
    然后 Localization (requires restart)",选择 Chinese-All-0313 ,点击应用设置 再重启UI

下载模型:

stable-diffusion-v1-5

Hugging Face 访问不了可以去魔搭社区

直接下载

v1-5-pruned-emaonly.safetensors

存放目录如下:

stable-diffusion-webui/

├── models/

│ └── Stable-diffusion/

│ └── v1-5-pruned-emaonly.safetensors # 模型文件

重启UI 就可以选中目标模型

问题 分词器下载失败

处理: 虚拟环境下找到 \Lib\site-packages\huggingface_hub\constants.py

修改国内镜像:

_HF_DEFAULT_ENDPOINT = "https://hf-mirror.com"

最后附加成品效果

相关推荐
_妲己2 天前
SD的细分功能包括重绘,图像处理、放大等扩散模型应用
人工智能·python·深度学习·机器学习·stable diffusion·comfyui·ai工作流
二院大蛙4 天前
Stable Diffusion 3.5 FP8在农业无人机航拍模拟图中的地形还原精度
stable diffusion· fp8· 农业无人机
或困4 天前
Stable Diffusion 3.5 FP8镜像支持灰度检测与异常报警
stable diffusion·灰度发布·fp8量化
沉默的大羚羊4 天前
Stable Diffusion 3.5 FP8模型可用于旅游宣传海报制作
stable diffusion·文生图·fp8
BOBO爱吃菠萝4 天前
Stable Diffusion 3.5 FP8镜像自动化部署脚本发布
stable diffusion·量化·fp8
九章云极AladdinEdu4 天前
项目分享|SD-Trainer:Stable Diffusion 训练集成工具
stable diffusion·端到端学习·高斯泼溅·3d场景分割·物体级代码本·2d到3d提升
qq_420443274 天前
AMD显卡在windows中通过WSL安装使用stable diffusion(WebUI和ComfyUI)
linux·windows·ubuntu·stable diffusion·wsl
网安入门学习4 天前
2025年AIGC人才需求报告:从招聘数据看行业趋势与技能要求
人工智能·windows·ai作画·stable diffusion·aigc
ai_xiaogui4 天前
Stable Diffusion Web UI 整合包一键安装教程:Windows/Mac零基础部署AI绘画工具
人工智能·ai作画·stable diffusion·一键整合包·ai生图神器·ai生图和动作迁移
人工智能AI技术5 天前
【SD教程】提示词
人工智能·stable diffusion·aigc·ai绘画