window系统运行pytorch找不到指定的模块,报错“fbgemm.dll“ or one of its dependencies.”

安装好pytorch后,import torch报错如下:

Traceback (most recent call last):
  File "d:\work_space\01_code\BMCourse\exercises\L2_NLP_pipeline_pytorch\annotated_code\test.py", line 1, in 
    import torch
  File "C:\Users\ZJ\AppData\Local\Programs\Python\Python312\Lib\site-packages\torch\__init__.py", line 148, in 
    raise err
OSError: [WinError 126] 找不到指定的模块。 Error loading "C:\Users\ZJ\AppData\Local\Programs\Python\Python312\Lib\site-packages\torch\lib\fbgemm.dll" or one of its dependencies.

这里提示加载不到fbgemm.dl或者缺少依赖项,但在xxx\Python\Python312\Lib\site-packages\torch\lib\ 路径下存在fbgemm.dll文件,那应该是缺少了依赖项

解决办法:

 1、下载Dependencies,用于window系统查看文件的依赖项,压缩文件包,运行DependenciesGui.exe,导入xxx\Python\Python312\Lib\site-packages\torch\lib\fbgemm.dll文件,可以看到红点确实的文件

window系统运行pytorch找不到指定的模块,报错“fbgemm.dll“ or one of its dependencies.”_第1张图片

2、我这里缺少的文件libomp140.x86_64.dll,把文件放到fbgemm.dll的同目录下即可

附件:所需文件包也可在csdn下载

https://download.csdn.net/download/weixin_44598491/89634591

你可能感兴趣的:(笔记)