在 Linux 系统上安装 ComfyUI
#环境准备
#列出所有已创建的Conda 环境:
conda env list
或
conda info --envs
#创建并激活 Conda 虚拟环境: 建议使用 Python 3.10。
conda create -n conda_comfyui python=3.10
conda activate conda_comfyui
#安装 PyTorch: 请根据你的 CUDA 版本选择对应的 PyTorch 安装命令。
#CUDA 12.1:
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
#CUDA 12.2:
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu122
#验证PyTorch是否能正确识别GPU
python3 -c "import torch; print('PyTorch版本:', torch.__version__); print('CUDA可用:', torch.cuda.is_available()); print('CUDA版本:', torch.version.cuda); print('GPU设备:', torch.cuda.get_device_name(0) if torch.cuda.is_available() else 'None'); print('GPU数量:', torch.cuda.device_count());"
#安装 ComfyUI:
git clone https://github.com/comfyanonymous/ComfyUI.git # 克隆仓库
#若速度慢,开多线程
git clone --depth=1 --jobs=4 https://github.com/comfyanonymous/ComfyUI.git
cd ComfyUI # 进入目录 pip install -r requirements.txt # 安装依赖
启动 ComfyUI:
python3 main.py
启动后,在浏览器中访问 http://127.0.0.1:8188即可使用 ComfyUI。
#如果需要指定监听地址(例如允许其他设备访问)或端口,可以使用:
python3 main.py --listen 0.0.0.0 --port 18188