1. 程式人生 > WINDOWS開發 >windows下升級TensorFlow到2.1.0

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安裝目錄對應子目錄。