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