这个堆栈跟踪告诉我什么是我的Tensorflow安装错误

时间:2018-05-17 11:45:10

标签: windows python-3.x tensorflow

我已经完成并安装了CUDA,cuDNN,并按照我的指示进行了操作。我已添加了我认为需要的环境变量,但我似乎仍有问题。

我已经到了测试,看看是否已正确安装tensorflow。在拉出命令提示符时,键入python以使用shell,我键入import tensorflow as tf

然后我得到了这个堆栈跟踪,这是我自己无法理解的问题。这是我需要社区帮助的地方:

>>> import tensorflow as tf
Traceback (most recent call last):
  File "C:\Users\Troy\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\platform\self_check.py", line 75, in preload_check
    ctypes.WinDLL(build_info.cudart_dll_name)
  File"C:\Users\Troy\AppData\Local\Programs\Python\Python36\lib\ctypes\__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Troy\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "C:\Users\Troy\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
  File "C:\Users\Troy\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 30, in <module>
self_check.preload_check()
  File "C:\Users\Troy\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\platform\self_check.py", line 82, in preload_check
% (build_info.cudart_dll_name, build_info.cuda_version_number))
ImportError: Could not find 'cudart64_90.dll'. TensorFlow requires that this DLL be installed in a directory that is named in your %PATH% environment variable. Download and install CUDA 9.0 from this URL: https://developer.nvidia.com/cuda-toolkit

1 个答案:

答案 0 :(得分:0)

请尝试安装CUDA 9.0。问题应该是CUDA 9.1版本。您可以从以下链接下载驱动程序:CUDA Toolkit 9.0

要卸载CUDA:

请运行以下命令:

 sudo apt-get --purge remove cuda
 sudo apt autoremove

这些命令应该能够从您的系统中卸载cuda。

如果您已将cuDNN配置为使用GPU:

您可以在设置过程中删除已复制到的目录中的文件。