Windows上安裝 TensorFlow
阿新 • • 發佈:2018-02-12
you html pat 網址 body imp 查看 遇到 可能
1、官網及幫助文檔
官網: https://www.tensorflow.org/install/install_windows
中文幫助文檔:https://efeiefei.gitbooks.io/tensorflow_documents_zh/install/install_windows.html
a) cpu版本安裝:pip3 install --upgrade tensorflow
b)gpu版本安裝:pip3 install --upgrade tensorflow-gpu,需要先安裝cuda,cudnn,需要註意版本
備註:目前tensorflow在windows只支持python3.5.x及以上版本,需要使用pip3安裝tensorflow。
2、cpu版本安裝可能遇到的問題
2.1、ImportError: Could not find ‘msvcp140.dll‘. TensorFlow requires that this DLL... ,解決方案:安裝微軟為VS2015提供的組件Visual C++ Redistributable for Visual Studio 2015,網址https://www.microsoft.com/zh-CN/download/details.aspx?id=48145,下載後直接安裝就好了。
2.2、Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2,應該是編譯問題,解決方案:
import os os.environ[‘TF_CPP_MIN_LOG_LEVEL‘] = ‘2‘ #忽略警告
3、簡單命令
a)查看tensorflow版本及安裝路徑
import tensorflow as tf
tf.__version__ #版本
tf.__path__ #路徑
Windows上安裝 TensorFlow