stable-diffusion + webui 环境搭建目录
一、Windows 环境部署 stable-diffusion-webui
1、准备条件
- 安装Python 3.10.X 以下版本
- 安装 Git
- 使用 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 存储库,
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、显示报错
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、准备条件
- 安装 Homebrew
- 安装 python3.10.x 以下版本
- 安装 Git
- 安装 wget
2、检查 Mac OS 自带版本
python3 -V # 查看Python3 版本
版本小于 Python 3.10.x 跳过卸载教程,高于 Python 3.10.x 请安装卸载教程卸载 Python3(小白篇,懂用虚拟配置的跳过)
3、卸载 Mac 自带的Python3 高于Python 3.10 版本
python3 -V
whereis python3 # 回车,查找Python3 版本
# python3: /usr/bin/python3 # 这是 Python3 安装路径
sudo rm -rf /usr/bin/python3 # 卸载Python3
python3 -V # 显示 zsh: command not found: python3 卸载成功
4、安装 Homebrew
# 打开 Mac 电脑终端,复制命令回车。《这里是国际地址,建议使用中国地址,不会的请自行百度搜索》
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
5、 安装 Python 3.10.x
使用命令安装 Python 3.10.x 版本
brew install python@3.10 # 回车
# 检查 Python3 是否安装成功
python3--version
使用程序安装:Python3.10.0 传送门
6、安装 Git 教程
# 打开 Mac 电脑终端,复制命令回车。
brew install git # 回车
# 检查安装是否成功
git --version
7、配置 Python3 环境变量
# 查找 Python 安装路径
whereis python3
# /usr/local/bin/python3.10
7.1、打开并编辑 .bash_profile 或 .zshrc 文件(根据 Mac 权限用户选择文件)
~/.bash_profile 文件是 bash 用户;
~/.zshrc 文件是zsh用户;
vi ~/.bash_profile # 回车 输入 i 进行编辑
export PATH="查找 Python 安装路径:$PATH"
# 例如:export PATH="/usr/local/bin/python3.10:$PATH"
alias python=python3.10 # 指定 Python3 版本
按 ESC 键退出编辑,输入写:wq! 回车
# 再使用下述命令执行该配置文件
source ~/.bash_profile # 这步很重要!!!
打开 Mac 终端 输入 Python3 -V ,如果有版本号显示,证明成功,如果没有安装下面的配置再操作一遍.
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 查询路径命令
brew --prefix python@3.10
# /usr/local/opt/python@3.10 这个路径很重要。
8、安装 wget 教程
brew install wget #查看版本
wget --version #查看是否有版本显示,有证明安装成功,没有证明失败
9、下载 stable-diffusion-webui (二选一)
# 进入目录
cd /Users/Mantis/Documents/stable-diffusion-webui # 这是我的目录,仅供参考
wget -q https://raw.githubusercontent.com/AUTOMATIC1111/stable-diffusion-webui/master/webui.sh
# 进入目录
cd /Users/Mantis/Documents/stable-diffusion-webui # 这是我的目录,仅供参考
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
10、运行 webui.sh 命令 (下载可以能需要科学上网)
# 进入目录
cd /Users/Mantis/Documents/stable-diffusion-webui # 这是我的目录,仅供参考
pwd #回车查看是否进入stable-diffusion-webu目录
./webui.sh
11、stable-diffusion-webui 文件目录重要讲解