天天看點

pip install torch on windows, and the 'from torch._C import * ImportError: DLL load failed:' s...

通過pip安裝PyTorch 0.4.0成功(cpu, not gpu; python3.5; pip):

pip3 install http://download.pytorch.org/whl/cpu/torch-0.4.0-cp35-cp35m-win_amd64.whl

pip3 install torchvision

但是import時報錯。

  import torch

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

    from torch._C import *

ImportError: DLL load failed: 找不到指定的子產品。

解決:

  • Download win-64/intel-openmp-2018.0.0-8.tar.bz2
  • put the dll files in Library\bin into a dir
  • append the path of it to the environment variable PATH.

參考:

from torch._C import * (ImportError: DLL load failed: The specified module could not be found.

驗證by me and:

https://my.oschina.net/lilinzero/blog/1822807

轉載于:https://www.cnblogs.com/squirrel2300/p/9183712.html