Windows64位安裝CPU版TensorFlow


  1. 推薦使用powershell,只需要在cmd指令窗口輸入powershell即可
  2. 下載64位Python3.5(一定要3.5!!)可以通過Python 3.5 from python.org 或 Python 3.5 from Anaconda 下載並安裝Python3.5.2(注意選擇正確的操作系統)。
  3. 具體教程可以查看Python3.5.2百度經驗安裝,里面有個細節,自動設置環境變量,不能忘
  4. 安裝VS2015,如果是2013的后面要加個插件,這是后話
  5. 為了使用國內鏡像加速pip安裝,需要如下修改:

    WIndows 7 在“C:\Users\用戶名\AppData\Local\pip”文件夾下,新建文本文件,添加內容:

  6. 關於鏡像參考http://www.cnblogs.com/microman/p/6107879.html
  7. 安裝CPU版TensorFlow 0.12,Power Shell下輸入:pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-0.12.0rc0-cp35-cp35m-win_amd64.whl
  8. 安裝GPU版TensorFlow 0.12,Power Shell下輸入:pip install --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-0.12.0rc0-cp35-cp35m-win_amd64.whl  
  9. 裝完后發現還是有問題:比如

    import tensorflow as tf 

    報錯為:

    Error importing tensorflow.  Unless you are using bazel,

    you should not try to import tensorflow from its source directory;
    please exit the tensorflow source tree, and relaunch your python interpreter

    from there.(這是因為裝了VS2013原因,要是直接2015應該沒事,所以要加補丁)

  10. 解決方案:.進入https://www.tensorflow.org/versions/r0.12/get_started/os_setup.html#pip-installation-on-windows,點擊下載vc_redist.x64.exe
  11. 安裝vc_redist.x64.exe,安裝時會出現 “正在處理 windon_msu_x64”時,是因為window缺少補丁,下載地址為:http://pan.baidu.com/s/1nvpsXVN

    完畢 可以運行了

  12. 然后基本就可以用了>>>import tensorflow as tf  
  13. 但是樓主在使用時發現Tensorflow的強大可視化工具Tensorboard無法用
  14. 找了很久原因,終於在簡書中找到一大神的說法,http://www.jianshu.com/p/4b92b19c97e2,原因就是版本的問題,對於Linux系統無論TensorFlow是0.12還是1.0都能很好的使用tensorboard;但是對於Windows系統,0.12是無法顯示的,1.0版本的TensorFlow是能顯示的,這個需要注意。
  15. 於是開始更新0.12版本到1.0,命令很簡單,還是powershell,pip3 install --upgrade tensorflow,具體鏈接見http://blog.csdn.net/u010099080/article/details/55260055


免責聲明!

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



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