TensorFlow教程

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

本文主要是介绍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

             

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

三、安装CUDNN

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

            

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

                

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

这篇关于Windows10安装TensorFlow-GPU版本及其依赖的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!