Windows上安装Tensorflow
2017-07-26 14:51
148 查看
1,TensorFlow只支持64位平台
2,下载python 3.5.X (必须是64位的),地址如下:
2,下载python 3.5.X (必须是64位的),地址如下:
https://www.python.org/ftp/python/3.5.2/python-3.5.2-amd64.exe https://www.python.org/ftp/python/3.5.2/python-3.5.2-embed-amd64.zip[/code]
3,安装python,并验证python和pipC:\Users\Administrator>python -V Python 3.5.2 C:\Users\Administrator>pip3 -V pip3 8.1.1 from d:\program files\python35\lib\site-packages (python 3.5)
4,安装TensorFlow(only cpu)pip3 install --upgrade tensorflow
5,TensorFlow的hello worldC:\Users\Administrator>python Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import tensorflow as tf >>> hello = tf.constant('Hello tensorflow1') >>> session = tf.Session() >>> print(session.run(hello)) b'Hello tensorflow1' 看到输出b'Hello tensorflow1'即证明TensorFlow环境安装完成.
6,如果你是java开发的话,可能想尝试下java API,结果很让人失望,太慢了,世界末日了,代码如下,自己去享受一把:public String tf() throws Exception{ final String value = "Hello tensorflow version : " + TensorFlow.version(); System.out.println(value); //将数据转为tensor Tensor tensor = Tensor.create(value.getBytes("UTF-8")); //构造一个图对象 Graph graph = new Graph(); graph.opBuilder("Const","myConst").setAttr("dtype",tensor.dataType()) .setAttr("value",tensor).build(); //创建一个Session Session session = new Session(graph); graph.close(); //计算输出结果 Tensor result = session.runner().fetch("myConst").run().get(0); System.out.println(result); return new String(result.bytesValue(),"UTF-8"); }
相关文章推荐
- Tensorflow在Windows下的安装+各种错误解决
- 在Windows下直接安装Tensorflow的Windows版本
- Windows下安装Tensorflow
- Windows 安装 TensorFlow 1.0 和 Gensim Numpy+mkl Scipy Bad Zip File
- TensorFLow学习(一)---原生Windows安装TensorFlow,进行MNIST机器学习
- windows 下 Anaconda 安装 TensorFlow
- Windows安装TensorFlow(TF更新至0.12版,添加了Windows支持)
- windows下tensorflow-GPU版本安装
- 在Windows 7 的64位系统上,安装tensorflow 的CPU版本
- Windows下安装tensorflow步骤
- Windows7下TensorFlow安装
- windows 下 TensorFlow(GPU 版)的安装
- TensorFlow在Windows 10上安装手记
- 170614 Windows10+Anaconda2/3+tensorflow-1.2.0rc2(cpu & gpu) 安装
- TensorFlow版本升级方法【之前通过Anaconda安装】(Windows)
- windows下安装tensorflow-gpu
- Windows安装TensorFlow_v1.0.1
- Windows环境下用Anaconda(2.7/3.6)安装GPU版TensorFlow
- windows下机器学习工具theano、caffe、tensorflow对比及theano的安装
- tensorflow在windows下的安装