在Windows 10上使用CUDA 9.1和Python 3.6进行Tensorflow安装

时间:2018-03-12 22:52:36

标签: python tensorflow cuda windows-10 anaconda

我在安装TensorFlow时遇到此错误。编辑:我安装了CUDA 9.0,并更改了我的环境变量,包括Path变量,现在它可以正常工作。

    (tensorflow-gpu) C:\Users\Admin>python
Python 3.6.4 |Anaconda, Inc.| (default, Mar  9 2018, 07:43:39) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
Traceback (most recent call last):
  File "C:\Users\Admin\AppData\Local\conda\conda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\platform\self_check.py", line 75, in preload_check
    ctypes.WinDLL(build_info.cudart_dll_name)
  File "C:\Users\Admin\AppData\Local\conda\conda\envs\tensorflow-gpu\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\Admin\AppData\Local\conda\conda\envs\tensorflow-gpu\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import *
  File "C:\Users\Admin\AppData\Local\conda\conda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Users\Admin\AppData\Local\conda\conda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 30, in <module>
    self_check.preload_check()
  File "C:\Users\Admin\AppData\Local\conda\conda\envs\tensorflow-gpu\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

这是一个非常类似的问题。

Tensorflow installation with CUDA 9.1 and python 3.6

1 个答案:

答案 0 :(得分:3)

这类似于Tensorflow import error

快速回答:默认情况下,NVidia将安装最新的版本的CUDA,现在是9.1

TensorFlow期待9.0,如“ImportError:找不到'cudart64_90.dll'”所示 - 请将其读作cuda-runtime-64-bit-version9.0 DLL

要解决此问题,请访问NVidia网站下载9.0版本的驱动程序,您将会很高兴。我在这里写了一个指南:http://www.laurencemoroney.com/installing-tensorflow-with-gpu-on-windows-10/