Windows10安装TensorFlow-GPU版本及其依赖

一、安装TensorFlow GPU版本

        1. 执行命令:pip install tensorflow-gpu==1.4.0

        2. 检查是否安装成功:

            在python中输入命令,提示需要安装CUDA

Python 3.6.2 |Anaconda, Inc.| (default, Sep 19 2017, 08:03:39) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>>
>>>
>>> import tensorflow
Traceback (most recent call last):
  File "F:\Anaconda3\lib\site-packages\tensorflow\python\platform\self_check.py", line 75, in preload_check
    ctypes.WinDLL(build_info.cudart_dll_name)
  File "F:\Anaconda3\lib\ctypes\__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] 找不到指定的模块。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "F:\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import *
  File "F:\Anaconda3\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "F:\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 30, in <module>
    self_check.preload_check()
  File "F:\Anaconda3\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_80.dll'. TensorFlow requires that this DLL be installed in a directory that is named in your %PATH% environment variable. Download and install CUDA 8.0 from this URL: https://developer.nvidia.com/cuda-toolkit

  二、安装CUDA

        1. 在设备管理中查看自己电脑是否支持NVIDIA

        2. 在官网下载:https://developer.nvidia.com/cuda-toolkit-archive

             Windows10安装TensorFlow-GPU版本及其依赖

            注:安装傻瓜式安装一直下一步就好

三、安装CUDNN

        1. 在官网下载(没有账号的需要注册):https://developer.nvidia.com/rdp/cudnn-archive

            Windows10安装TensorFlow-GPU版本及其依赖

        2. 在环境变量中找到CUDA的安装位置,将CUDNN解压后的三个文件全部复制到里面:

              Windows10安装TensorFlow-GPU版本及其依赖  

最后在运行TensorFlow就不会报错了

上一篇:windows10, python3, pip 报错


下一篇:Windows10如何升级Windows11