"将张量流导入为tf" ImportError:找不到' cudart64_90.dll'

时间:2018-02-12 00:13:58

标签: python python-3.x tensorflow cuda

我正在尝试学习Python,特别是TensorFlow。我已经按照说明操作并且已经克服了几个问题并且已经成功安装了TensorFlow(pip install),CUDA(9.1.85 win10),Python(3.6.3 amd64)和CUDNN(8.0 win10x64),因为我有GPU( GTX 1080)并希望能够用它训练网络。我的计算机有一个intel i7和Windows 10.我从CUDA(8.0.61 win10)开始,但它导致了一个错误,表示它需要版本9.

当我尝试用

进行测试时
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))

我在第一行收到此错误

>>> import tensorflow as tf
Traceback (most recent call last):
  File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\platform\self_check.py", line 75, in preload_check
    ctypes.WinDLL(build_info.cudart_dll_name)
  File "C:\Program Files\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 "<pyshell#0>", line 1, in <module>
    import tensorflow as tf
  File "C:\Program Files\Python36\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import *
  File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 30, in <module>
    self_check.preload_check()
  File "C:\Program Files\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

我该如何解决这个问题?

PS:我已在此网站上阅读了有关此内容的所有其他问题,并且还阅读了common problems页面。对不起,这些错误似乎与我的具体问题不符,但显然我迷失在这里。

1 个答案:

答案 0 :(得分:4)

Tensorflow目前不支持CUDA 9.1(可能会尽快更改):https://github.com/tensorflow/tensorflow/issues/15656

您可以从以下网址下载并安装CUDA 9.0:https://developer.nvidia.com/cuda-toolkit