(Pro-test success) Pytorch error (Windows platform): from torch._C import * ImportError: DLL load failed: The specified module could not be found.

This error is very strange, I did not come across many times before installation, and the reason may be related to the installation process.
(My anaconda pytorch virtual environment is a good time to install but can not be found with a few days with the emergence of this issue)
tested a variety of methods to reinstall numpy available online add environment variables to add dll and so useless

(base) C:\Users\Administrator>conda activate torch
 
(torch) C:\Users\Administrator>python
Python 3.7.2 (default, Feb 11 2019, 14:11:50) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "d:\Anaconda3\envs\torch\lib\site-packages\torch\__init__.py", line 84, in <module>
    from torch._C import *
ImportError: DLL load failed: 找不到指定的模块。
>>>

Note
Then I suddenly thought I recently spent some time libtorch lib and dll this package into the c drive of the Windows system32 where
is the cause of Python compiler to find conflict between the two dll not correct the dll

So I put D: \ Anaconda3 \ envs \ torch11 \ Lib \ site-packages \ torch \ dll and lib files under lib This path copied to the C: \ Windows \ System32 this path then the problem successfully resolved ha ha hope to help other junior partner

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "d:\Anaconda3\envs\torch11\lib\site-packages\torch\__init__.py", line 79, in <module>
    from torch._C import *
ImportError: DLL load failed: 找不到指定的程序。
>>> import torch11
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'torch11'
>>> import torch
>>> exit()

Guess you like

Origin blog.csdn.net/j879159541/article/details/90736533