当前位置: 代码网 > it编程>编程语言>Asp.net > 解决pytorch找不到shm.dll模块的问题

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

2026年04月09日 Asp.net 我要评论
找不到指定的模块 shm.dll启动comfyui_windows_portable时报错,提示找不到指定的模块,…\torch\lib\shm.dll" or one of

找不到指定的模块 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,成功!

到此这篇关于解决pytorch找不到shm.dll模块的问题的文章就介绍到这了,更多相关pytorch找不到shm.dll模块内容请搜索代码网以前的文章或继续浏览下面的相关文章希望大家以后多多支持代码网!

(0)

相关文章:

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论

验证码:
Copyright © 2017-2026  代码网 保留所有权利. 粤ICP备2024248653号
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com