ComfyUI 实战教程:Flux模特换装/虚拟试衣

部署运行你感兴趣的模型镜像

最近随着 Flux.1 Tools 相关模型的发布,AI绘画界又迎来了一场饕餮盛宴,各种玩法层出不穷。这篇文章接着介绍 Flux.1 Tools 的一个高级玩法:模特换装。

使用IDM-VTON和OOTDiffusion进行图生图换装,其中使用OOTDiffusion换装的效果最好,使用 Flux.1 Tools 和 使用 OOTDiffusion 进行模特换装的方法不太一样,不过因为采用Flux模型的原因,效果也是杠杠滴,具体请看我一一道来。

效果展示

废话不多少,还是先看效果。

环境准备

因为目前还是ComfyUI对Flux模型的支持效果最好,所以这里的基础环境还是ComfyUI。

本地安装

如果你本地有一个24G左右显存的Nvidia显卡,可以在本地部署一个ComfyUI。

不过想要运行本文介绍的工作流,你还要安装缺失的插件节点、下载相关的模型,这个难度和工作量不容小视,没有点技术功底不要轻易尝试,折腾的时间成本也是很高的。

产品图和模特图

首先是准备好服装的产品图,正面平整为佳;同时还要准备好待换装的模特图,给需要换装的位置增加遮罩。

这里的遮罩方法我提供了两种,一种是手动涂抹,另一种是自动识别服装进行遮罩。

注意,如果“模特的服装遮盖区域”明显小于“产品服装的遮盖区域”,这时候建议使用手动遮罩,因为此时自动遮罩产生的遮罩图可能不能覆盖所有的服装区域。

图片预处理

这里对图片进行预处理,主要两个功能:

一是防止图片过大或过小,统一为一个合适的尺寸;

二是把服装产品图和模特图拼到一起,让后续重绘的时候有个更好的参考。

风格提取

这里使用的是Flux.1 Tools中的Redux模型,它具有风格迁移的能力,这里用来提取服装产品图的信息。

注意它影响的是“条件”参数,之前广泛使用的 IpAdapter 影响的是“模型”,所以说 Redux 和 IPAdapter 还是有明显区别的,只是它们的目标相同。

重绘采样

这里使用的是 Flux.1 Fill 模型,它具有优秀的局部重绘的能力,这部分的目的就是重绘模特身上的服装。

到这一步,我们就可以实现基本的模特换装了。

不过可能还有两个问题:

一是重绘的服装上可能有横纹、竖纹,这可以做一个简单的一步重绘进行优化。

二是服装上的Logo可能不像,这时候可以使用手动遮罩来对Logo部分再次进行Redux重绘。

为了帮助大家更好地掌握 ComfyUI,我在去年花了几个月的时间,撰写并录制了一套ComfyUI的基础教程,共六篇。这套教程详细介绍了选择ComfyUI的理由、其优缺点、下载安装方法、模型与插件的安装、工作流节点和底层逻辑详解、遮罩修改重绘/Inpenting模块以及SDXL工作流手把手搭建。

由于篇幅原因,本文精选几个章节,详细版点击下方卡片免费领取
在这里插入图片描述

一、ComfyUI配置指南

  • 报错指南
  • 环境配置
  • 脚本更新
  • 后记

img

二、ComfyUI基础入门

  • 软件安装篇
  • 插件安装篇

img

三、 ComfyUI工作流节点/底层逻辑详解

  • ComfyUI 基础概念理解
  • Stable diffusion 工作原理
  • 工作流底层逻辑
  • 必备插件补全

img

四、ComfyUI节点技巧进阶/多模型串联

  • 节点进阶详解
  • 提词技巧精通
  • 多模型节点串联

img

五、ComfyUI遮罩修改重绘/Inpenting模块详解

  • 图像分辨率
  • 姿势

img

六、ComfyUI超实用SDXL工作流手把手搭建

  • Refined模型
  • SDXL风格化提示词
  • SDXL工作流搭建

img

由于篇幅原因,本文精选几个章节,详细版点击下方卡片免费领取
在这里插入图片描述

img

您可能感兴趣的与本文相关的镜像

ComfyUI

ComfyUI

AI应用
ComfyUI

ComfyUI是一款易于上手的工作流设计工具,具有以下特点:基于工作流节点设计,可视化工作流搭建,快速切换工作流,对显存占用小,速度快,支持多种插件,如ADetailer、Controlnet和AnimateDIFF等

aria2: http://192.168.0.100:6800 [START] Security scan [DONE] Security scan ## ComfyUI-Manager: installing dependencies done. ** ComfyUI startup time: 2025-08-18 01:01:22.434 ** Platform: Windows ** Python version: 3.12.11 (main, Aug 8 2025, 17:05:04) [MSC v.1944 64 bit (AMD64)] ** Python executable: E:\ComfyUI\.venv\Scripts\python.exe ** ComfyUI Path: E:\ComfyUI\ComfyUI ** ComfyUI Base Folder Path: E:\ComfyUI\ComfyUI ** User directory: E:\ComfyUI\ComfyUI\user ** ComfyUI-Manager config path: E:\ComfyUI\ComfyUI\user\default\ComfyUI-Manager\config.ini ** Log path: E:\ComfyUI\ComfyUI\user\comfyui.log Prestartup times for custom nodes: 0.0 seconds: E:\ComfyUI\ComfyUI\custom_nodes\comfyui-easy-use 0.0 seconds: E:\ComfyUI\ComfyUI\custom_nodes\rgthree-comfy 2.6 seconds: E:\ComfyUI\ComfyUI\custom_nodes\ComfyUI-Manager Checkpoint files will always be loaded safely. Total VRAM 16303 MB, total RAM 130789 MB pytorch version: 2.8.0+cu128 Set vram state to: NORMAL_VRAM Device: cuda:0 NVIDIA GeForce RTX 5080 : cudaMallocAsync Using pytorch attention Python version: 3.12.11 (main, Aug 8 2025, 17:05:04) [MSC v.1944 64 bit (AMD64)] ComfyUI version: 0.3.50 ComfyUI frontend version: 1.24.4 [Prompt Server] web root: E:\ComfyUI\.venv\Lib\site-packages\comfyui_frontend_package\static Error: [WinError 1314] 客户端没有所需的特权。: 'E:\\ComfyUI\\ComfyUI\\custom_nodes\\ComfyLiterals\\js' -> 'E:\\ComfyUI\\ComfyUI\\web\\extensions\\ComfyLiterals' Failed to create symlink to E:\ComfyUI\ComfyUI\web\extensions\ComfyLiterals. Please copy the folder manually. Source: E:\ComfyUI\ComfyUI\custom_nodes\ComfyLiterals\js Target: E:\ComfyUI\ComfyUI\web\extensions\ComfyLiterals WARNING[XFORMERS]: xFormers can't load C++/CUDA extensions. xFormers was built for: PyTorch 2.7.1+cu128 with CUDA 1208 (you have 2.8.0+cu128) Python 3.9.13 (you have 3.12.11) Please reinstall xformers (see https://github.com/facebookresearch/xformers#installing-xformers) Memory-efficient attention, SwiGLU, sparse and more won't be available. Set XFORMERS_MORE_DETAILS=1 for more details xFormers not available xFormers not available Module 'diffusers' load failed. If you don't have it installed, do it: pip install diffusers [ComfyUI-Easy-Use] server: v1.3.2 Loaded [ComfyUI-Easy-Use] web root: E:\ComfyUI\ComfyUI\custom_nodes\comfyui-easy-use\web_version/v2 Loaded theUpsiders Logic Nodes: Loaded ### Loading: ComfyUI-Manager (V3.36) [ComfyUI-Manager] network_mode: public ### ComfyUI Version: v0.3.50-6-ge4f7ea10 | Released on '2025-08-13' [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/alter-list.json [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/model-list.json [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/github-stats.json [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/extension-node-map.json -------------- ### Mixlab Nodes: Loaded json_repair## OK ChatGPT.available True edit_mask.available True ## clip_interrogator_model not found: E:\ComfyUI\ComfyUI\models\clip_interrogator\Salesforce\blip-image-captioning-base, pls download from https://huggingface.co/Salesforce/blip-image-captioning-base ClipInterrogator.available True ## text_generator_model not found: E:\ComfyUI\ComfyUI\models\prompt_generator\text2image-prompt-generator, pls download from https://huggingface.co/succinctly/text2image-prompt-generator/tree/main ## zh_en_model not found: E:\ComfyUI\ComfyUI\models\prompt_generator\opus-mt-zh-en, pls download from https://huggingface.co/Helsinki-NLP/opus-mt-zh-en/tree/main PromptGenerate.available True ChinesePrompt.available True RembgNode_.available True ffmpeg could not be found. Using ffmpeg from imageio-ffmpeg. Use Proxy: http://192.168.0.100:7897 TripoSR.available MiniCPMNode.available Scenedetect.available FishSpeech.available SenseVoice.available False Whisper.available False fal-client## OK FalVideo.available -------------- Use Proxy: http://192.168.0.100:7897 ======================================== ComfyUI-nunchaku Initialization ======================================== Nunchaku version: 0.3.1 ComfyUI-nunchaku version: 0.3.3 Traceback (most recent call last): File "E:\ComfyUI\.venv\Lib\site-packages\diffusers\utils\import_utils.py", line 883, in _get_module return importlib.import_module("." + module_name, self.__name__) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Roaming\uv\python\cpython-3.12.11-windows-x86_64-none\Lib\importlib\__init__.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<frozen importlib._bootstrap>", line 1387, in _gcd_import File "<frozen importlib._bootstrap>", line 1360, in _find_and_load File "<frozen importlib._bootstrap>", line 1310, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 1387, in _gcd_import File "<frozen importlib._bootstrap>", line 1360, in _find_and_load File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 935, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 999, in exec_module File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed File "E:\ComfyUI\.venv\Lib\site-packages\diffusers\models\transformers\__init__.py", line 5, in <module> from .auraflow_transformer_2d import AuraFlowTransformer2DModel File "E:\ComfyUI\.venv\Lib\site-packages\diffusers\models\transformers\auraflow_transformer_2d.py", line 26, in <module> from ..attention_processor import ( File "E:\ComfyUI\.venv\Lib\site-packages\diffusers\models\attention_processor.py", line 35, in <module> import xformers.ops File "E:\ComfyUI\.venv\Lib\site-packages\xformers\ops\__init__.py", line 9, in <module> from .fmha import ( File "E:\ComfyUI\.venv\Lib\site-packages\xformers\ops\fmha\__init__.py", line 10, in <module> from . import ( File "E:\ComfyUI\.venv\Lib\site-packages\xformers\ops\fmha\flash3.py", line 109, in <module> from ...flash_attn_3 import _C # type: ignore[attr-defined] # noqa: F401 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ImportError: DLL load failed while importing _C: 找不到指定的程序。 The above exception was the direct cause of the following exception: Traceback (most recent call last): File "E:\ComfyUI\ComfyUI\nodes.py", line 2129, in load_custom_node module_spec.loader.exec_module(module) File "<frozen importlib._bootstrap_external>", line 999, in exec_module File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed File "E:\ComfyUI\ComfyUI\custom_nodes\ComfyUI-nunchaku\__init__.py", line 31, in <module> from .nodes.models.flux import NunchakuFluxDiTLoader File "E:\ComfyUI\ComfyUI\custom_nodes\ComfyUI-nunchaku\nodes\models\flux.py", line 11, in <module> from diffusers import FluxTransformer2DModel File "<frozen importlib._bootstrap>", line 1412, in _handle_fromlist File "E:\ComfyUI\.venv\Lib\site-packages\diffusers\utils\import_utils.py", line 874, in __getattr__ value = getattr(module, name) ^^^^^^^^^^^^^^^^^^^^^ File "E:\ComfyUI\.venv\Lib\site-packages\diffusers\utils\import_utils.py", line 873, in __getattr__ module = self._get_module(self._class_to_module[name]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\ComfyUI\.venv\Lib\site-packages\diffusers\utils\import_utils.py", line 885, in _get_module raise RuntimeError( RuntimeError: Failed to import diffusers.models.transformers.transformer_flux because of the following error (look up to see its traceback): DLL load failed while importing _C: 找不到指定的程序。 Cannot import E:\ComfyUI\ComfyUI\custom_nodes\ComfyUI-nunchaku module for custom nodes: Failed to import diffusers.models.transformers.transformer_flux because of the following error (look up to see its traceback): DLL load failed while importing _C: 找不到指定的程序。 Error loading AILab_SegmentV2.py: No module named 'groundingdino' [ComfyUI-RMBG] v2.5.0 | 26 nodes Loaded ------------------------------------------ Comfyroll Studio v1.76 : 175 Nodes Loaded ------------------------------------------ ** For changes, please see patch notes at https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/blob/main/Patch_Notes.md ** For help, please see the wiki at https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki ------------------------------------------ [E:\ComfyUI\ComfyUI\custom_nodes\comfyui_controlnet_aux] | INFO -> Using ckpts path: E:\ComfyUI\ComfyUI\custom_nodes\comfyui_controlnet_aux\ckpts [E:\ComfyUI\ComfyUI\custom_nodes\comfyui_controlnet_aux] | INFO -> Using symlinks: False [E:\ComfyUI\ComfyUI\custom_nodes\comfyui_controlnet_aux] | INFO -> Using ort providers: ['CUDAExecutionProvider', 'DirectMLExecutionProvider', 'OpenVINOExecutionProvider', 'ROCMExecutionProvider', 'CPUExecutionProvider', 'CoreMLExecutionProvider'] E:\ComfyUI\ComfyUI\custom_nodes\comfyui_controlnet_aux\node_wrappers\dwpose.py:26: UserWarning: DWPose: Onnxruntime not found or doesn't come with acceleration providers, switch to OpenCV with CPU device. DWPose might run very slowly warnings.warn("DWPose: Onnxruntime not found or doesn't come with acceleration providers, switch to OpenCV with CPU device. DWPose might run very slowly") Use Proxy: http://192.168.0.100:7897 FETCH ComfyRegistry Data: 5/94 ### [START] ComfyUI AlekPet Nodes v1.0.77 ### Node -> ArgosTranslateNode: ArgosTranslateCLIPTextEncodeNode, ArgosTranslateTextNode [Loading] Node -> ChatGLMNode[Loading] Node -> DeepLXTranslateNode[Loading] Node -> DeepTranslatorNode: DeepTranslatorCLIPTextEncodeNode, DeepTranslatorTextNode [Loading] Node -> ExtrasNode: PreviewTextNode, HexToHueNode, ColorsCorrectNode [Loading] Node -> GoogleTranslateNode: GoogleTranslateCLIPTextEncodeNode, GoogleTranslateTextNode [Loading] Node -> IDENode: IDENode [Loading] Node -> PainterNode: PainterNode [Loading] Node -> PoseNode: PoseNode [Loading] ### [END] ComfyUI AlekPet Nodes ### # 😺dzNodes: LayerStyle -> Cannot import name 'guidedFilter' from 'cv2.ximgproc' A few nodes cannot works properly, while most nodes are not affected. Please REINSTALL package 'opencv-contrib-python'. For detail refer to https://github.com/chflame163/ComfyUI_LayerStyle/issues/5 Initializing ControlAltAI Nodes Use Proxy: http://192.168.0.100:7897 [rgthree-comfy] Loaded 47 magnificent nodes. 🎉 Import times for custom nodes: 0.0 seconds: E:\ComfyUI\ComfyUI\custom_nodes\websocket_image_save.py 0.0 seconds: E:\ComfyUI\ComfyUI\custom_nodes\comfyui_ttp_toolset 0.0 seconds: E:\ComfyUI\ComfyUI\custom_nodes\comfyui-inpainteasy 0.0 seconds: E:\ComfyUI\ComfyUI\custom_nodes\ComfyLiterals 0.0 seconds: E:\ComfyUI\ComfyUI\custom_nodes\comfyui_slk_joy_caption_two 0.0 seconds: E:\ComfyUI\ComfyUI\custom_nodes\comfyui-logic 0.0 seconds: E:\ComfyUI\ComfyUI\custom_nodes\ComfyUI_IPAdapter_plus 0.0 seconds: E:\ComfyUI\ComfyUI\custom_nodes\comfyui-custom-scripts 0.0 seconds: E:\ComfyUI\ComfyUI\custom_nodes\comfyui-inpaint-nodes 0.0 seconds: E:\ComfyUI\ComfyUI\custom_nodes\comfyui_essentials 0.0 seconds: E:\ComfyUI\ComfyUI\custom_nodes\ControlAltAI-Nodes 0.0 seconds: E:\ComfyUI\ComfyUI\custom_nodes\comfyui-advanced-controlnet 0.0 seconds: E:\ComfyUI\ComfyUI\custom_nodes\ComfyUI-KJNodes 0.0 seconds: E:\ComfyUI\ComfyUI\custom_nodes\derfuu_comfyui_moddednodes 0.0 seconds: E:\ComfyUI\ComfyUI\custom_nodes\ComfyUI-RMBG 0.0 seconds: E:\ComfyUI\ComfyUI\custom_nodes\comfyui-tooling-nodes 0.0 seconds: E:\ComfyUI\ComfyUI\custom_nodes\ComfyUI_Mira 0.0 seconds: E:\ComfyUI\ComfyUI\custom_nodes\ComfyUI_Comfyroll_CustomNodes 0.0 seconds: E:\ComfyUI\ComfyUI\custom_nodes\comfyui_controlnet_aux 0.1 seconds: E:\ComfyUI\ComfyUI\custom_nodes\comfyui-model-manager 0.1 seconds: E:\ComfyUI\ComfyUI\custom_nodes\ComfyUI-Dwpose-Tensorrt 0.1 seconds: E:\ComfyUI\ComfyUI\custom_nodes\ComfyUI_LayerStyle 0.2 seconds (IMPORT FAILED): E:\ComfyUI\ComfyUI\custom_nodes\ComfyUI-nunchaku 0.3 seconds: E:\ComfyUI\ComfyUI\custom_nodes\comfyui-florence2 0.4 seconds: E:\ComfyUI\ComfyUI\custom_nodes\ComfyUI-Depth-Anything-Tensorrt 0.5 seconds: E:\ComfyUI\ComfyUI\custom_nodes\ComfyUI-Manager 0.7 seconds: E:\ComfyUI\ComfyUI\custom_nodes\rgthree-comfy 1.7 seconds: E:\ComfyUI\ComfyUI\custom_nodes\comfyui-depthanythingv2 1.8 seconds: E:\ComfyUI\ComfyUI\custom_nodes\comfyui_custom_nodes_alekpet 1.8 seconds: E:\ComfyUI\ComfyUI\custom_nodes\comfyui-easy-use 4.5 seconds: E:\ComfyUI\ComfyUI\custom_nodes\comfyui-mixlab-nodes Context impl SQLiteImpl. Will assume non-transactional DDL. No target revision found. Starting server To see the GUI go to: http://0.0.0.0:8188 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 E:\ComfyUI\ComfyUI\custom_nodes\comfyui-mixlab-nodes\webApp\lib/photoswipe-lightbox.esm.min.js E:\ComfyUI\ComfyUI\custom_nodes\comfyui-mixlab-nodes\webApp\lib/pickr.min.js E:\ComfyUI\ComfyUI\custom_nodes\comfyui-mixlab-nodes\webApp\lib/photoswipe.min.css E:\ComfyUI\ComfyUI\custom_nodes\comfyui-mixlab-nodes\webApp\lib/classic.min.css E:\ComfyUI\ComfyUI\custom_nodes\comfyui-mixlab-nodes\webApp\lib/model-viewer.min.js E:\ComfyUI\ComfyUI\custom_nodes\comfyui-mixlab-nodes\webApp\lib/juxtapose.css E:\ComfyUI\ComfyUI\custom_nodes\comfyui-mixlab-nodes\webApp\lib/juxtapose.min.js Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 FETCH ComfyRegistry Data: 10/94 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 FETCH ComfyRegistry Data: 15/94 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 FETCH ComfyRegistry Data: 20/94 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 FETCH ComfyRegistry Data: 25/94 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 FETCH ComfyRegistry Data: 30/94 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 FETCH ComfyRegistry Data: 35/94 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 FETCH ComfyRegistry Data: 40/94 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 FETCH ComfyRegistry Data: 45/94 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 FETCH ComfyRegistry Data: 50/94 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 FETCH ComfyRegistry Data: 55/94 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 FETCH ComfyRegistry Data: 60/94 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 FETCH ComfyRegistry Data: 65/94 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 FETCH ComfyRegistry Data: 70/94 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 FETCH ComfyRegistry Data: 75/94 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 FETCH ComfyRegistry Data: 80/94 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 FETCH ComfyRegistry Data: 85/94 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 FETCH ComfyRegistry Data: 90/94 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 Use Proxy: http://192.168.0.100:7897 FETCH ComfyRegistry Data [DONE] [ComfyUI-Manager] default cache updated: https://api.comfy.org/nodes mode: remote filename: custom-node-list.json channel_url: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main FETCH DATA from: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.jsonUse Proxy: http://192.168.0.100:7897 [DONE] Merge json from \\192.168.0.100\mcs\ComfyUI\custom-list;\\192.168.0.100\mcs\ComfyUI\civitai-list Merge json from \\192.168.0.100\mcs\ComfyUI\custom-list\custom-node-list.json FETCH DATA from: \\192.168.0.100\mcs\ComfyUI\custom-list\custom-node-list.json [DONE] merge custom_nodes [ComfyUI-Manager] broken item:{'title': 'ComfyUI Dwpose TensorRT', 'reference': 'https://github.com/yuvraj108c/ComfyUI-Dwpose-Tensorrt', 'req_models': [{'name': 'DWPose-l ucoco 384', 'reference': 'https://huggingface.co/yzd-v/DWPose'}, {'name': 'DWPose yolox l', 'reference': 'https://huggingface.co/yzd-v/DWPose'}]} [ComfyUI-Manager] broken item:{'title': 'ComfyUI Depth Anything TensorRT', 'reference': 'https://github.com/yuvraj108c/ComfyUI-Depth-Anything-Tensorrt', 'req_models': [{'name': 'Depth Anything 2 Onnx Large', 'reference': 'https://huggingface.co/yuvraj108c/Depth-Anything-2-Onnx'}]} [ComfyUI-Manager] All startup tasks have been completed.
08-19
<think>嗯,用户遇到了ComfyUI启动时的多个错误,包括DLL加载失败、依赖缺失和权限问题。这确实是个棘手的情况,但通过系统化的排查应该能解决。 用户可能已经尝试过直接运行ComfyUI但被各种错误阻挡,现在需要专业的故障排除指导。考虑到错误类型多样,需要分层处理:先解决环境依赖问题,再处理权限配置,最后排查自定义节点兼容性。 从技术角度看,DLL加载失败通常指向三个方向:Python环境损坏、CUDA版本冲突或系统路径问题。而模块缺失错误往往是因为pip安装不完整或虚拟环境配置错误。权限问题则多发生在Windows系统对Program Files目录的写入限制。 特别要注意的是自定义节点引发的错误链。很多用户会忽略节点之间的依赖关系,比如某些节点需要特定版本的PyTorch。建议用户采用"二分法"排查:先禁用所有自定义节点,再逐个启用测试。 用户可能没意识到的是:某些错误其实是前序问题的衍生现象。比如权限不足可能导致依赖安装不完整,进而引发模块缺失。所以修复时要按"环境→权限→节点"的顺序推进。 值得推荐的做法是使用conda创建纯净环境,这能隔离系统Python的影响。另外提供requirements.txt的生成方法很关键,因为很多用户不知道pip freeze这个命令。 最后要提醒用户注意Windows Defender的实时防护,它有时会阻止dll加载却不显示警告。暂时禁用防病毒软件测试是个有效手段,但测试后要及时恢复。</think>排查ComfyUI启动错误的系统化解决方案如下: ### 一、解决DLL加载失败问题(核心依赖修复) 1. **更新Visual C++运行库** 安装最新版[Microsoft Visual C++ Redistributable](https://learn.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist) ```powershell winget install Microsoft.VCRedist.2022.x64 ``` 2. **验证CUDA/cuDNN兼容性** - 执行 `nvidia-smi` 查看驱动支持的CUDA版本 - 检查`comfyui\python_embeded`目录是否存在冲突的旧版CUDA DLL - 通过[NVIDIA官方文档](https://docs.nvidia.com/deploy/cuda-compatibility/)确认版本匹配性 3. **修复PATH环境变量** 在启动脚本(`run_nvidia_gpu.bat`)开头添加: ```bat set PATH=%cd%\python_embeded;%cd%\python_embeded\Scripts;%PATH% ``` ### 二、修复缺失模块错误(虚拟环境重建) ```powershell # 进入ComfyUI目录 cd ComfyUI_windows_portable # 清除旧环境 rmdir /S /Q python_embeded rmdir /S /Q ComfyUI\venv # 重建虚拟环境(使用管理员权限) python -m venv ComfyUI\venv ComfyUI\venv\Scripts\activate # 安装核心依赖 pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 pip install -r requirements.txt ``` ### 三、解决权限不足问题(系统级配置) 1. **目录所有权修正**: ```powershell takeown /f "ComfyUI_windows_portable" /r /d y icacls "ComfyUI_windows_portable" /grant Users:(OI)(CI)F /t ``` 2. **防火墙例外规则**: ```powershell New-NetFirewallRule -DisplayName "ComfyUI" -Direction Inbound -Program "ComfyUI_windows_portable\python_embeded\python.exe" -Action Allow ``` ### 四、自定义节点冲突排查 1. **隔离测试模式**: ```bash python main.py --disable-custom-nodes ``` 若正常启动,说明问题在第三方节点 2. **节点诊断流程**: ```mermaid graph LR A[清空custom_nodes目录] --> B[逐批复制节点] B --> C{启动成功?} C -->|失败| D[定位问题节点] C -->|成功| E[继续添加] ``` 3. **常见问题节点修复**: ```bash # 示例:修复ControlNet预处理器 pip install -U opencv-python-headless ``` ### 五、高级疑难排查 1. **依赖树分析**: ```bash pipdeptree --warn silence | findstr "Conflict" ``` 2. **调试模式启动**: ```bash python main.py --enable-dev-options --log-level debug ``` 3. **日志分析要点**: - 搜索`ERROR`/`CRITICAL`级别日志 - 检查最后加载的模块名 - 确认CUDA初始化状态 > **重要提示**:若使用Windows安全软件,需将整个目录加入排除列表,实时防护可能阻断DLL加载[^1]。完成修复后建议创建环境快照: > ```bash > pip freeze > requirements_lock.txt > ``` --- ### 相关问题 1. **如何诊断ComfyUI启动时的CUDA内存分配错误?** 2. **Windows系统下ComfyUI自动更新失败应如何手动更新?** 3. **自定义节点与主程序版本不兼容时有哪些降级方案?** 4. **如何配置ComfyUI在无GPU的机器上使用CPU模式运行?** [^1]: 微软官方文档指出安全软件可能拦截运行时库加载,建议在开发期间临时禁用实时保护
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值