Windows下TensorFlow安装指南(图文版)

时间:2021-11-24 01:12:48

随着深度学习概念火起来,TensorFlow也跟着成为业界流行的深度学习框架。它采用CPU+GPU的并行计算模式,使得神经网络可以有效的并行计算,从以前的三层网络到现在的深层网络,深度学习+tensorflow已经开始深入人心。

笔者也本着投石问路的心态,尝试玩一玩这个高大上的东西。那么先从安装开始吧~

如果有*工具的话,安装是很简单的。

安装Python3.5+

(注意tensorflow只支持3.5以上的版本,2.7是安装不了的)

我这里下载的是3.5.2,注意要找到对应版本的python才可以:https://www.python.org/downloads/release/python-352/

比如,我是win10 64位的系统,那么就需要下载下面这个:

Windows下TensorFlow安装指南(图文版)

下载后直接安装即可。

如果使用的是sublimeText编辑器,需要修改下sublimetext里面关联的python路径:

{
"cmd": ["C:/Users/xinghailong/AppData/Local/Programs/Python/Python35/python.exe", "-u", "$file"],
"file_regex": "^[ ]File \"(…?)\", line ([0-9]*)",
"selector": "source.python"
}

测试一下:

Windows下TensorFlow安装指南(图文版)

安装TensorFlow

直接输入pip3 install --upgrade tensorflow即可,下载CPU版本的tensorflow。

tensorflow支持两种版本的安装:

  • 1 tensorflow,仅支持CPU版本(如果没有对应的显卡开发,那么可以考虑安装这个,跑个hello world就行了)
  • 2 tensorflow-gpu,支持GPU版本(如果你有NVIDIA的显卡,可以考虑开启这个)

Windows下TensorFlow安装指南(图文版)

这样就安装完了!

可以编写一个hello world程序:

import tensorflow as tf

a = tf.constant('hello')
with tf.Session() as sess:
print(sess.run(a))

参考资料

1 tensorflow的官方文档:https://www.tensorflow.org/install/

2 深度学习入门学习文章:http://blog.jobbole.com/105602/

3 深度学习花书:https://github.com/exacity/deeplearningbook-chinese

4 tobe的github:https://github.com/tobegit3hub

5 tobe的微博:http://weibo.com/tobegit3hub?is_hot=1#_rnd1501482257802

6 anaconda:https://www.continuum.io/downloads

6 推荐系统论文:https://amundtveit.com/2016/11/20/recommender-systems-with-deep-learning/

7 推荐系统论文:http://www.wanghao.in/publication.html