Windows環境下的TensorFlow安裝過程


Windows環境下的TensorFlow安裝過程

 

安裝環境

  • Windows8.1
  • python3.5.x(TensorFlow only supports version 3.5.x of Python on Windows)
  • pip 9.0.1
  • tensorflow-gpu-0.12.0
  • cuda

cudnn

安裝過程

  • 安裝Python3.5

  • 安裝python     

     下載地址: https://www.python.org/

  1. 點擊Downloads下的Windows,本次選用了Python 3.5.2版本

     

      選擇其中的第五個,Windows x86-64 executable installer下載安裝(安裝的時候最好把添加環境變量那個打鈎,這樣就不需要自己配置環境變量)

     2. 升級pip

        打開cmd輸入

python.exe -m pip install --upgrade pip
  • 安裝TensorFlow

     (本次采用的在線安裝,也可以下載到本地,進行本地安裝)

     安裝gpu版本

pip install --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-0.12.0-cp35-cp35m-win_amd64.whl

 

     安裝CPU版本

pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-0.12.0-cp35-cp35m-win_amd64.whl

   

     查看你的gpu是否支持cuda

     gpu版本要安裝gpu支持包(cuda8.0地址cudnn5.1地址

     安裝cuda8.0

    

    安裝對應的cudnn(這個貌似需要登錄Nvidia賬號才能夠下載,我是先注冊的)

    找到你需要的版本,下載cudnn壓縮文件后進行解壓,添加解壓后的bin目錄到PATH環境變量。

  • 測試TensorFlow

打開cmd,輸入python,然后輸入 import tensorflow,如果結果和下圖一樣,則說明安裝成功。

 

復制代碼
$ python
...
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))
Hello, TensorFlow!
>>> a = tf.constant(1)
>>> b = tf.constant(2)
>>> print(sess.run(a + b))
3
復制代碼

如遇到‘ is not a supported wheel on this platform’ 問題,請看博客:

tensorflow安裝遇到‘ is not a supported wheel on this platform’ 問題

以上內容參考自網絡教程,本人以博客的方式記錄,如有侵犯請告知。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM