解决pytorch找不到shm.dll模块的问题

找不到指定的模块 shm.dll

启动ComfyUI_windows_portable时报错,提示找不到指定的模块,…\torch\lib\shm.dll" or one of its dependencies. 但是在对应的python sitepackage中shm是存在的。

import torch

报错 ,说明pytorch的依赖关系有问题了。由于ComfyUI_windows_portable使用了embeded python,卸载现有的torch

.\python_embeded\python.exe python_embeded\Lib\site-packages\pip uninstall torch

过程显示,torch安装了torch-2.3.1+cu121。
重新安装torch

.\python_embeded\python.exe python_embeded\Lib\site-packages\pip install torch==2.3.1

安装成功,重新启动ComfyUI,提示AttributeError: module ‘torch’ has no attribute ‘Tensor’,报错退出。于是尝试升级torch

.\python_embeded\python.exe python_embeded\Lib\site-packages\pip install --upgrade torch

出现…requires torch 2.3.1+cu121, but you have torch 2.3.1 which is incompatible…,显然这个torch和torch-2.3.1+cu121是不兼容的。卸载torch 2.3.1,重新安装

.\python_embeded\python.exe python_embeded\Lib\site-packages\pip install torch==2.3.1+cu121 -f https://download.pytorch.org/whl/torch_stable.html

开始下载https://download.pytorch.org/whl/cu121/torch-2.3.1%2Bcu121-cp311-cp311-win_amd64.whl,有2.4GB。可以自行下载torch 2.3.1+cu121,注意选择正确的操作系统、CPU架构和python版本的whl文件,可以使用下载工具,提高下载速度。
离线安装whl

.\python_embeded\python.exe python_embeded\Lib\site-packages\pip install torch-2.3.1+cu121-cp311-cp311-win_amd64.whl

显示安装“success”,重启ComfyUI,成功!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值