stable-diffusion + webui 環境搭建目錄
- 一、Windows 環境部署 stable-diffusion-webui
- 1、準備條件
- 2、安裝Python 3.10.X(**較新版本的 Python 不支持 torch**)
- 3、安裝Git 教程
- 4、使用Git 下載 stable-diffusion-webui 存儲庫,
- 4.1、顯示報錯
- 5、運行 webui-user.bat
- 二、Mac OS 環境部署 stable-diffusion-webui
- 1、準備條件
- 2、檢查 Mac OS 自帶版本
- 3、卸載 Mac 自帶的Python3 高于Python 3.10 版本
- 4、安裝 Homebrew
- 5、 安裝 Python 3.10.x
- 6、安裝 Git 教程
- 7、配置 Python3 環境變量
- 7.1、打開并編輯 .bash_profile 或 .zshrc 文件(根據 Mac 權限用戶選擇文件)
- 7.2、使用 brew 安裝 Python3 查詢路徑命令
- 8、安裝 wget 教程
- 9、下載 stable-diffusion-webui (二選一)
- 10、運行 webui.sh 命令 (下載可以能需要科學上網)
- 11、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 文件目錄重要講解