「Windows/Mac OS」AIGC图片生成视频 ,webui + stable-diffusion环境部署教程

stable-diffusion + webui 环境搭建目录

  • [一、Windows 环境部署 stable-diffusion-webui](#一、Windows 环境部署 stable-diffusion-webui)
    • 1、准备条件
    • [2、安装Python 3.10.X(**较新版本的 Python 不支持 torch**)](#2、安装Python 3.10.X(较新版本的 Python 不支持 torch))
    • [3、安装Git 教程](#3、安装Git 教程)
    • [4、使用Git 下载 stable-diffusion-webui 存储库,](#4、使用Git 下载 stable-diffusion-webui 存储库,)
    • [5、运行 webui-user.bat](#5、运行 webui-user.bat)
  • [二、Mac OS 环境部署 stable-diffusion-webui](#二、Mac OS 环境部署 stable-diffusion-webui)
    • 1、准备条件
    • [2、检查 Mac OS 自带版本](#2、检查 Mac OS 自带版本)
      • [3、卸载 Mac 自带的Python3 高于Python 3.10 版本](#3、卸载 Mac 自带的Python3 高于Python 3.10 版本)
    • [4、安装 Homebrew](#4、安装 Homebrew)
    • [5、 安装 Python 3.10.x](#5、 安装 Python 3.10.x)
    • [6、安装 Git 教程](#6、安装 Git 教程)
    • [7、配置 Python3 环境变量](#7、配置 Python3 环境变量)
      • [7.1、打开并编辑 .bash_profile 或 .zshrc 文件(根据 Mac 权限用户选择文件)](#7.1、打开并编辑 .bash_profile 或 .zshrc 文件(根据 Mac 权限用户选择文件))
      • [7.2、使用 brew 安装 Python3 查询路径命令](#7.2、使用 brew 安装 Python3 查询路径命令)
    • [8、安装 wget 教程](#8、安装 wget 教程)
    • [9、下载 stable-diffusion-webui (二选一)](#9、下载 stable-diffusion-webui (二选一))
    • [10、运行 webui.sh 命令 (下载可以能需要科学上网)](#10、运行 webui.sh 命令 (下载可以能需要科学上网))
    • [11、stable-diffusion-webui 文件目录重要讲解](#11、stable-diffusion-webui 文件目录重要讲解)

一、Windows 环境部署 stable-diffusion-webui

1、准备条件

  1. 安装Python 3.10.X 以下版本
  2. 安装 Git
  3. 使用 Git 下载 stable-diffusion-webui 存储库

2、安装Python 3.10.X(较新版本的 Python 不支持 torch

Python3.10 下载地址:传送门

安装 Python 3 教程

检查是否安装成功 Windows+R 输入 cmd 回车

3、安装Git 教程

Git下载地址: 传送门

Git 安装,点击下一步...... 直到 install 按钮出显,然后点击 install 按钮安装即可。

验证git 是否安装成功。Windows+R 输入cmd 回车,终端输入: git --version 回车

4、使用Git 下载 stable-diffusion-webui 存储库,

shell 复制代码
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git  #克隆库

git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git C:\Users\Mantis\Documents\stable-diffusion-webui   # 指定目录克隆,仅供参考,不要复制使用  

4.1、显示报错

shell 复制代码
git config --global http.sslBackend schannel  #输入这个代码回车,
# 再执行一下面命令
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git  

5、运行 webui-user.bat

以普通、非管理员、用户身份从 Windows 资源管理器运行
进入刚刚下载 stable-diffusion-webui 目录


出现下图问题,没有找到Python3 ,需要配置环境变量,不会配置自行百度。

正常启动会自动下载程序.文件比较大请耐心等待。如果下载失败重新打开webui.bat文件,还是现在失败,请使用科学上网后,再进行下载。

二、Mac OS 环境部署 stable-diffusion-webui

1、准备条件

  1. 安装 Homebrew
  2. 安装 python3.10.x 以下版本
  3. 安装 Git
  4. 安装 wget

2、检查 Mac OS 自带版本

shell 复制代码
python3 -V  # 查看Python3 版本

版本小于 Python 3.10.x 跳过卸载教程,高于 Python 3.10.x 请安装卸载教程卸载 Python3(小白篇,懂用虚拟配置的跳过)

3、卸载 Mac 自带的Python3 高于Python 3.10 版本

shell 复制代码
python3 -V 
shell 复制代码
whereis python3  # 回车,查找Python3 版本
# python3: /usr/bin/python3  # 这是 Python3 安装路径
sudo rm -rf /usr/bin/python3   # 卸载Python3 

python3 -V # 显示 zsh: command not found: python3 卸载成功

4、安装 Homebrew

shell 复制代码
# 打开 Mac 电脑终端,复制命令回车。《这里是国际地址,建议使用中国地址,不会的请自行百度搜索》
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

5、 安装 Python 3.10.x

使用命令安装 Python 3.10.x 版本

shell 复制代码
brew install python@3.10  # 回车

# 检查 Python3 是否安装成功
python3--version

使用程序安装:Python3.10.0 传送门

6、安装 Git 教程

shell 复制代码
# 打开 Mac 电脑终端,复制命令回车。
brew install git # 回车

# 检查安装是否成功
git --version

7、配置 Python3 环境变量

bash 复制代码
# 查找 Python 安装路径
whereis python3 

# /usr/local/bin/python3.10

7.1、打开并编辑 .bash_profile 或 .zshrc 文件(根据 Mac 权限用户选择文件)

~/.bash_profile 文件是 bash 用户;

~/.zshrc 文件是zsh用户;

bash 复制代码
vi  ~/.bash_profile  # 回车 输入 i 进行编辑
export PATH="查找 Python 安装路径:$PATH"
# 例如:export PATH="/usr/local/bin/python3.10:$PATH"
alias python=python3.10  # 指定 Python3 版本

按 ESC 键退出编辑,输入写:wq! 回车

bash 复制代码
# 再使用下述命令执行该配置文件
source ~/.bash_profile  # 这步很重要!!!

打开 Mac 终端 输入 Python3 -V ,如果有版本号显示,证明成功,如果没有安装下面的配置再操作一遍.

bash 复制代码
vi  ~/.zshrc # 回车 输入 i 进行编辑

export PATH="查找 Python 安装路径:$PATH"
# 例如:export PATH="/usr/local/bin/python3.10:$PATH"
alias python=python3.10  # 指定 Python3 版本

# 按 ESC 键退出编辑,输入写:wq! 回车

# 再使用下述命令执行该配置文件
source ~/.zshrc

打开 Mac 终端 输入 Python3 -V ,如果有版本号显示,证明成功,如果没有请自行百度.

7.2、使用 brew 安装 Python3 查询路径命令

bash 复制代码
brew --prefix python@3.10 
# /usr/local/opt/python@3.10  这个路径很重要。

8、安装 wget 教程

bash 复制代码
brew install wget   #查看版本

wget --version  #查看是否有版本显示,有证明安装成功,没有证明失败

9、下载 stable-diffusion-webui (二选一)

bash 复制代码
# 进入目录
cd /Users/Mantis/Documents/stable-diffusion-webui # 这是我的目录,仅供参考
wget -q https://raw.githubusercontent.com/AUTOMATIC1111/stable-diffusion-webui/master/webui.sh
bash 复制代码
# 进入目录
cd /Users/Mantis/Documents/stable-diffusion-webui # 这是我的目录,仅供参考
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui

10、运行 webui.sh 命令 (下载可以能需要科学上网)

bash 复制代码
# 进入目录
cd /Users/Mantis/Documents/stable-diffusion-webui # 这是我的目录,仅供参考
pwd  #回车查看是否进入stable-diffusion-webu目录
./webui.sh

11、stable-diffusion-webui 文件目录重要讲解


相关推荐
emplace_back2 小时前
C# 集合表达式和展开运算符 (..) 详解
开发语言·windows·c#
AirDroid_cn6 小时前
OPPO手机怎样被其他手机远程控制?两台OPPO手机如何相互远程控制?
android·windows·ios·智能手机·iphone·远程工作·远程控制
小龙在山东8 小时前
Python 包管理工具 uv
windows·python·uv
昏睡红猹8 小时前
我在厂里搞wine的日子
windows·wine
love530love11 小时前
Docker 稳定运行与存储优化全攻略(含可视化指南)
运维·人工智能·windows·docker·容器
1024小神16 小时前
tauri项目在windows上的c盘没有权限写入文件
c语言·开发语言·windows
程序视点1 天前
Window 10文件拷贝总是卡很久?快来试试这款小工具,榨干硬盘速度!
windows
wuk9981 天前
基于MATLAB编制的锂离子电池伪二维模型
linux·windows·github
lzb_kkk1 天前
【C++】C++四种类型转换操作符详解
开发语言·c++·windows·1024程序员节