cat /etc/centos-releaseStable Diffusion 需要 Python 3.10+
python3 --version如果是 3.6 / 3.8:
# 安装 Python 3.10
yum install -y gcc make openssl-devel bzip2-devel libffi-devel
wget https://www.python.org/ftp/python/3.10.12/Python-3.10.12.tgz
tar xzf Python-3.10.12.tgz
cd Python-3.10.12
./configure --enable-optimizations
make -j$(nproc)
make altinstall使用:
python3.10 -m venv venv
source venv/bin/activatenvidia-smi如果报错:
command not found → 没装驱动NVIDIA-SMI has failed → 驱动崩了yum install -y epel-release
yum install -y dkms
# 去 NVIDIA 官网下载 run 文件
sh NVIDIA-Linux-x86_64-*.run# CUDA 11.8 示例
yum install -y cuda-11-8验证:
nvcc -VIllegal instruction (core dumped)✅ 原因:CPU 太老 / PyTorch 不兼容
✅ 解决:
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpulibGL.so.1: cannot open shared object file✅ 缺少图形库
yum install -y mesa-libGLNo module named 'xformers'✅ 不用强行装(CentOS 很难装)
export COMMANDLINE_ARGS="--disable-xformers"Permission deniedchmod -R 755 stable-diffusion-webui
chown -R $USER:$USER stable-diffusion-webuistrings /lib64/libc.so.6 | grep GLIBCdocker run -it \
--gpus all \
-p 7860:7860 \
-v $PWD/models:/models \
pytorch/pytorch:2.1.0-cuda11.8-cudnn8-develgit clone https://github.com/comfyanonymous/ComfyUI
pip install -r requirements.txt请把以下信息发我:
我可以一步一步带你修 ✅