«

stable-diffusion-webui环境搭建和避坑指南

WAP站长网 发布于 阅读:38 SEO教程


目前最火最便捷的SD框架就是stable-diffusion-webui虽然这套框架已经达到了一键搭建环境,但是由于各种环境的原因,仍然会出现一些问题,我在搭建过程中也出现了一些问题,把出现的问题和解决思路就以下,建议运行webui.sh或者webui.bat出错之后,直接按照以下操作完成之后再重新运行

代码优化

首先对launch.py进行一些优化,

把pip地址加上国内镜像

run_pip 方法中

return run(f'"{python}" -m pip {args} --prefer-binary{index_url_line} ', desc=f"Installing {desc}", errdesc=f"Couldn't install {desc}")

修改为:

return run(f'"{python}" -m pip {args} --prefer-binary{index_url_line} -i https://pypi.tuna.tsinghua.edu.cn/simple', desc=f"Installing {desc}", errdesc=f"Couldn't install {desc}")

1.gfpgan 无法安装的问题

解决方案:

切换到webui.sh或者webui.bat生成的venv环境下,手动下载 GFPGAN ,进入GFPGAN目录,

依次运行

# Install basicsr - https://github.com/xinntao/BasicSR # We use BasicSR for both training and inference pip install basicsr # Install facexlib - https://github.com/xinntao/facexlib # We use face detection and face restoration helper in the facexlib package pip install facexlib # If you want to enhance the background (non-face) regions with Real-ESRGAN, # you also need to install the realesrgan package pip install realesrgan pip install -r requirements.txt python setup.py develop 

2.open_clip无法安装的问题

解决方案:

切换到webui.sh或者webui.bat生成的venv环境下,手动下载 open_clip,进入open_clip目录,

运行

python setup.py build install

参考:安装gfpgan失败的解决方案

codeganwebuiwebpython解决方案cliclipurlgithubgit代码优化botdiffusionelo