2024年【Stable Diffusion安装】支持python3

本文详细介绍了如何在Python3环境中安装Stable Diffusion,包括修改launch_utils.py和webui-user.bat文件,配置git代理,设置pip下载源,安装CUDA,处理pip安装失败的问题,以及解决RuntimeError与GPU使用问题。提供了具体的命令行操作和文件修改步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

修改launch_utils.py文件

路径:

stable-diffusion-webui-master\modules\launch_utils.py 

搜索关键字:xformers,找到platform.python_version().startswith,改为3.11
在这里插入图片描述

修改webui-user.bat文件

路径:

stable-diffusion-webui-master\modules\webui-user.bat

主要是修改:COMMANDLINE_ARGS

@echo off

set PYTHON=
set GIT=
set VENV_DIR=
set COMMANDLINE_ARGS=--no-half-vae --disable-nan-check --skip-python-version-check --force-enable-xformers --xformers

call webui.bat

配置git代理

我的代理:

在这里插入图片描述
所以你也需要根据自己的代理来修改下面的端口号。

git config --global https.proxy http://127.0.0.1:7890
git config --global https.proxy https://127.0.0.1:7890

假设想去掉代理:

# 恢复
git config --global --unset http.proxy
git config --global --unset https.proxy

include-system-site-packages 这个参数可以设置是否开启“引用系统中的模块”的功能。如果开启了,那么当你就可以直接使用系统中已经装过的第三方模块。(但是你在虚拟环境下装的模块就不能被其他地方的程序使用)

设置pip下载源、代理、升级

# 设置源
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple 
pip config set install.trusted-host mirrors.aliyun.com

设置代理,路径:C:\Users\yutao\AppData\Roaming\pip\pip.ini

[global]
index-url = https://mirrors.aliyun.com/pypi/simple
proxy = http://127.0.0.1:7890

[install]
trusted-host = mirrors.aliyun.com

升级pip,在cmd中:

C:\Us
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值