DLL load failed on window10 with latest version

ImportError                               Traceback (most recent call last)
<ipython-input-7-ce8d15220a2c> in <module>
----> 1 import torch
      2 
      3 
      4 print(torch.__version__)

c:\users\nathan\pytorch\torch-env\lib\site-packages\torch\__init__.py in <module>
     79 del _dl_flags
     80 
---> 81 from torch._C import *
     82 
     83 __all__ += [name for name in dir(_C)

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

I have created a virtualenv using python 3.7 (prue python) which contains torch1.2
I got this problem after I update torch1.3 (just pip install and did not uninstall torch1.2)

After I delete all python related file(python file, pip cache) and reinstalled I still got this error. I think maybe it is a version related problem?

My solution is to use conda.

To make it short, it means that you lacked some “dependencies” for the libraries you wanted to use. This is a common problem when installing python packages, mainly in windows. Before trying to use any kind of library, first it is suggested to look up whether it needs another library in python “family”.

The solution is to provide the python interpreter with the path-to-your-module/library. The simplest solution is to append that python path to your sys.path list. In your notebook, first try:

import sys
sys.path.append('my/path/to/module/folder')

This isn’t a permanent change in sys.path, because when you log out, your environment is reset, so any variables you may have set are lost.

The better (and more permanent) way to solve this is to set your PYTHONPATH, which provides the interpreter with additional directories look in for python packages/modules.

from BASH type: export PYTHONPATH=/path/to/new/folder:/another/path/...../ #each path must be separated by a colon