从torch._C import * ImportError:DLL加载失败:找不到指定的模块
我正在尝试使用python 3.5在Windows机器中import torch
. (仅CPU)(pip)
我已按照官方网站中给出的步骤进行操作.
I am trying to import torch
in my windows machine using python 3.5. (CPU only)(pip)
I have followed the steps given in the official website.
当我尝试导入割炬时,出现错误:
When I try to import torch it gives me the error:
from torch._C import *
ImportError: DLL load failed: The specified module could not be found.
我从torch._C import中查找了 *(ImportError:DLL加载失败:指定和 ModuleNotFoundError:没有名为"torch._C"的模块并按照他们的指示进行操作,但错误仍然存在.
I have looked up from torch._C import * (ImportError: DLL load failed: The specified module could not be found. and ModuleNotFoundError: No module named 'torch._C' and followed their instructions, still the error persists.
总回溯:
Traceback (most recent call last):
File "D:\CFPS.py", line 1, in <module>
import torch
File "C:\Program Files (x86)\Python35\lib\site-packages\torch\__init__.py",
line 78, in <module>
from torch._C import *
ImportError: DLL load failed: The specified module could not be found.
[Finished in 0.6s]
有没有办法解决这个问题?
Is there a way to get past through this?
我遇到了同样的问题. Pytorch似乎需要openmp,但这不是PIP发行版的一部分.
I've been encountering the same problem. Pytorch seems to require openmp, however this is not part of the PIP distribution.
如果通过Anaconda安装Pytorch,则Anaconda安装中将包含openmp,因此此问题将消失.
If you install Pytorch through Anaconda, the Anaconda install includes openmp, so this problem goes away.
要通过点子解决此问题,您可以 pip安装intel-openmp
To resolve this problem with pip, you can pip install intel-openmp
,但是您仍然必须将openmp二进制文件从Python \ Library \ bin复制到 Python \ Lib \ site-packages \ torch \ lib
but you still have to copy the openmp binaries from Python\Library\bin over to Python\Lib\site-packages\torch\lib
这是pytorch问题的链接
Here's a link to the pytorch issue