问题描述
我目前在 Anaconda 上使用 Python 3.5.5,但无法导入 Torch.它在 Spyder 中给了我以下错误:
I am currently using Python 3.5.5 on Anaconda and I am unable to import torch. It is giving me the following error in Spyder:
Python 3.5.5 |Anaconda, Inc.| (default, Mar 12 2018, 17:44:09) [MSC v.1900
64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.
IPython 6.2.1 -- An enhanced Interactive Python.
import torch
Traceback (most recent call last):
File "<ipython-input-1-eb42ca6e4af3>", line 1, in <module>
import torch
File "C:\Users\trish\Anaconda3\envs\virtual_platform\lib\site-
packages\torch\__init__.py", line 76, in <module>
from torch._C import *
ImportError: DLL load failed: The specified module could not be found.
互联网上的许多建议都说工作目录不应该与火炬包所在的目录相同,但是我手动将工作目录设置为 C:/Users/trish/Downloads,并且我得到了同样的错误.
Many suggestions on the internet say that the working directory should not be the same directory that the torch package is in, however I've manually set my working directory to C:/Users/trish/Downloads, and I am getting the same error.
此外,我已经尝试了以下操作:从头开始重新安装 Anaconda 和所有软件包,并且我确保我的目录中没有重复的torch"文件夹.
Also I've already tried the following: reinstalling Anaconda and all packages from scratch, and I've ensured there is no duplicate "torch" folder in my directory.
请帮忙!谢谢!
推荐答案
我在 Windows 10 中遇到过类似的问题...
I had this similar problem in windows 10...
解决方案:
从
Download win-64/intel-openmp-2018.0.0-8.tar.bz2 from https://anaconda.org/anaconda/intel-openmp/files
解压并将Library\bin中的dll文件放到C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin
Extract it and put the dll files in Library\bin into C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin
确保您的 cuda 目录已添加到您的 %PATH%
环境变量
Make sure your cuda directory is added to your %PATH%
environment variable
这篇关于“进口火炬"给出错误“from torch._C import *, DLL load failed: The specified module could not be found";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!