Pytorch导入错误:ImportError: DLL load failed or one of its dependencies.


最近项目中用到torch库,在导入touch库时报了如下错误:

OSError: [WinError 126] 找不到指定的模块。 Error loading "E:\****\Python36\lib\site-packages\torch\lib\caffe2_detectron_ops_gpu.dll" or one of its dependencies.

看了下安装目录里面是存在这些dll的,但是依旧是访问不到,想着可能是那个配置有问题,经过一顿猛如虎的操作下终于解决了。

首先我是win10系统,自己另外下载的torch类包文件,如果你是pip方式下载的,按理说也是可以解决此类问题的。

torch类库下载以及配置可参考博客:

torch类库下载以及配置

 

解决办法:

下载文件 win-64/intel-openmp-2020.1-216.tar.bz2 并解压,

下载网址:

文件下载

压缩文件网盘地址:

链接:某度网盘下载
提取码:ls4p

 

打开解压后的文件夹中的 Library/bin,将其中的两个 .dll 文件复制并放在一个新的文件夹中。

将 .dll 文件的文件夹路径添加到系统的环境变量中,重启 Python 有关的软件即可。

在重启后运行程序,还是会报错,会提示你下载一个.exe文件,下载安装后即可解决.dll访问不到的问题。

该exe文件是安装一些微软常用运行库集合,具体不深挖了。

exe文件下载地址:

文件下载

exe文件网盘地址:

链接:某度网盘下载
提取码:3g7s

 

测试torch安装成功的办法

import torch

print('torch版本:' + torch.__version__)

运行以上代码,得到如下结果说明已安装成功。

运行结果:torch版本:1.6.0


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



猜您在找 错误处理:"Could not load file or assembly 'Oracle.DataAccess' or one of its dependencies. An attempt was made to load a program with an incorrect format." Could not load file or assembly or one of its dependencies. 试图加载格式不正确的程序。 Pytorch安装出现OSError: [WinError 126] 找不到指定的模块。 Error loading "xx\lib\site-packages\torch\lib\asmjit.dll" or one of its dependencies. CefSharp"Could not load file or assembly 'CefSharp.Core.dll' or one of its dependencies" .netcore在linux上使用FreeSpire.Doc向Word中添加图片报错:System.DllNotFoundException: Unable to load shared library 'libgdiplus' or one of its dependencies. Unable to load shared library 'libwkhtmltox' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibwkhtmltox Could not load file or assembly 'Microsoft.ReportViewer.Common, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definiti SQLite 解决:Could not load file or assembly 'System.Data.SQLite ... 试图加载格式不正确的程序/or one of its dependencies. 找不到指定的模块。 System.DllNotFoundException: Unable to load DLL 'wpcap' or one of its dependencies: 找不到指定的模块。 (0x8007007E) OSError: [WinError 1455] 页面文件太小,无法完成操作。 Error loading "C:\Anaconda\envs\py3710\lib\site-packages\torch\lib\caffe2_nvrtc.dll" or one of its dependencies.
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM