windows下升级TensorFlow到2.1.0

1、pip install tensorflow-gpu==2.1.0 --user(pip install tensorflow-gpu==2.1.0 -i https://pypi.tuna.tsinghua.edu.cn/simple --user)

2、安装VC_redist.x64.exe:

下载:https://download.visualstudio.microsoft.com/download/pr/8c211be1-c537-4402-82e7-a8fb5ee05e8a/B6C82087A2C443DB859FDBEAAE7F46244D06C3F2A7F71C35E50358066253DE52/VC_redist.x64.exe

安装

2、import tensorflow出错:

   Could not load dynamic library ‘cudart64_101.dll‘; dlerror: cudart64_101.dll not found

解决办法:https://cn.dll-files.com/cudart64_101.dll.html

下载cudart64_101.zip

解压后把dll文件拷贝到:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin

3、import成功:

>>> import tensorflow
2020-03-23 15:37:43.258666: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
>>> tensorflow.__version__
‘2.1.0‘

4、升级cuda到10.1版本:https://developer.nvidia.com/cuda-downloads 下载:cuda_10.1.105_418.96_win10,自定义安装。

安装成功后,验证:

import tensorflow as tf

  #验证cuda
  a = tf.test.is_built_with_cuda()
  print(a)

  physical_devices = tf.config.experimental.list_physical_devices(‘GPU‘)
  print(physical_devices)

 5、升级cudnn到7.6.5:

安装cudnn7.6.5 for cuda10.1 for windows,下载:cudnn-10.1-windows10-x64-v7.6.5.32.zip,https://developer.nvidia.com/rdp/cudnn-download

把bin、include、lib里面的文件分别复制到cuda安装目录对应子目录。

相关推荐