我安装了Tensorflow gpu版本和CUDA 9.1以及python 3.6.5。但是,在导入tensorflow-gpu后,我收到以下错误:

时间:2018-05-16 20:25:00

标签: python windows tensorflow

追踪(最近一次呼叫最后一次):

  File "C:\Users\ranji\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\ranji\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

在处理上述异常期间,发生了另一个异常:

Traceback (most recent call last):
  File "C:/Users/ranji/AppData/Local/Programs/Python/Python36/ts1.py", line 1, in <module>
    import tensorflow as tf
  File "C:\Users\ranji\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\ranji\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\ranji\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 30, in <module>
    self_check.preload_check()
  File "C:\Users\ranji\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 :(得分:2)

  

目前,Tensorflow仅支持CUDA 9.0

但是你已经安装了CUDA 9.1。您现在有两个选择:

  • 选项1:您从源代码编译Tensorflow,然后启用对CUDA版本9.1的支持

  • 选项2:您安装CUDA 9.0 并等到Tensorflow支持CUDA 9.1

我经历了同样的痛苦并决定安装CUDA 9.0。这可能不那么麻烦了。

关于Tensorflow对CUDA 9.1的支持的当前状态以及如何从源代码编译Tensorflow,请参阅此issue on GitHub