一、前言
最近在家背八股文背诵得快吐了,烦闷的时候,看到使用 AI 进行作图,可以使用本地话部署。刚好自己家里的电脑,之前买来玩暗黑4,配置相对来说来可以,就拿来试试。
此篇是按照 Github 上的 stable-diffusion-webui 相关说明进行部署,开始前先看下 GitHub 上的安装步骤吧:

二、安装 Python
1、到 Python 的官网进行下载,这里注意咯,并不是使用最新版本哦,这里推荐使用 3.10.6

2、开始安装

修改安装路径:

安装成功:

打开 cmd ,输入 python --version,如果有以下提示,证明安装成功了:

二、安装 Git
Git 官网下载Git的安装包,Git 对于版本没有要求。我的电脑已经装了,这里不再详述了。装完后,在桌面空白处点击鼠标右键,出现底下图片中的Git 选项即可:
三、下载 stable-diffusion-webui
在 GitHub 地址中,拉取代码,GitHub 的地址:GitHub - AUTOMATIC1111/stable-diffusion-webui: Stable Diffusion web UI
在Git的窗口中,输入以下命令:
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
如下所示:

进入到对应的目录中,选择最新的 tag v1.8.0:

四、安装
在上面Git下载代码后的目录中,寻找 webui-user.bat,双击后,出现以下窗口:

过一会就开始下载了安装了:这里最好开下魔法
虽然开了魔法,但是...但是...还是报错了。记住,Error code: 128 的问题,就是下载失败,从报错的提示语,可以看出来具体是哪个库下载失败了:

在modules 的文件夹中,可以看到文件 launch_utils.py,打开此文件,在410行左右:

就是这些需要clone的失败了,我们要做的就是把这些库自己下载到根目录下的 repositories 文件夹中,并且按照要求的进行命名即可。
举个栗子:
git_clone(blip_repo, repo_dir('BLIP'), "BLIP", blip_commit_hash)
这里需要去下载 BLIP,对应的GitHub地址在 blip_repo 中,下载后,需要将文件夹重命名为 repo_dir 中指定的名字。
等待下载完成后,重新双击 webui-user.bat,接下来的时间会比较久,等到出现以下信息就证明安装成功了:

在浏览器中输入上面的网址,可以看到以下页面:
