Python 错误 Window 下通过pip安装 Pytorch出现 ImportError: DLL load failed: 找不到指定的模块。

一、Python Error

Window 下通过 pip 安装 Pytorch 成功,但是在 import torch 时报错:

import torch
File "D:\Python\Python36\lib\site-packages\torch\__init__.py", line 78, in <module>
    from torch._C import *

ImportError: DLL load failed: 找不到指定的模块。

二、解决方法

  1. 打开 https://anaconda.org/anaconda/intel-openmp/files,下载 win-64/intel-openmp-2018.0.0-8.tar.bz2 并解压 (根据自己的系统下载,我的系统的 win64 位)。
  2. 打开解压后的文件夹 intel-openmp-2018.0.0-8 中的 Library/bin,将其中的两个 .dll 文件复制并放在一个新的文件夹中。
  3. .dll 文件的文件夹路径添加到系统的环境变量中,重启 Python 有关的软件即可。


发布了31 篇原创文章 · 获赞 30 · 访问量 8万+

猜你喜欢

转载自blog.csdn.net/linchunmian/article/details/80520145