Chinaunix首页 | 论坛 | 博客
  • 博客访问: 111755
  • 博文数量: 28
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 277
  • 用 户 组: 普通用户
  • 注册时间: 2014-10-20 16:21
文章分类
文章存档

2019年(1)

2018年(2)

2017年(22)

2016年(3)

我的朋友

分类: 系统运维

2018-05-04 11:14:46

1、安装依赖包:


点击(此处)折叠或打开

  1. [root@localhost ~]#yum install wget gcc gcc-devel glibc glibc-devel gzip2 -y

2、下载Anaconda:


点击(此处)折叠或打开

  1. [root@localhost ~]#wget rs.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda2-2.5.0-Linux-x86_64.sh --no-check-certificate

3、安装Anaconda


点击(此处)折叠或打开

  1. [root@localhost ~]# bash Anaconda2-2.5.0-Linux-x86_64.sh


安装提示中anaconda2 安装目录选/srv/anaconda2

4、配置anaconda2环境变量为/srv/anaconda2


点击(此处)折叠或打开

  1. [root@localhost ~]# vi ~/.bashrc #追加以下行
  2. export PATH=/srv/anaconda2/bin:$PATH
  3. [root@localhost ~]# source ~/.bashrc

5、安装TensorFlow


点击(此处)折叠或打开

  1. [root@localhost ~]#conda create -n tensorflow python=2.7
  2. [root@localhost ~]#conda install -c conda-forge tensorflow
  3. [root@localhost ~]#source activate tensorflow
  4. [root@localhost ~]#pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow

6、验证

进入python

点击(此处)折叠或打开

  1. [root@ulife3 ~]# source activate tensorflow
  2. (tensorflow) [root@ulife3 ~]# python
  3. Python 2.7.13 |Continuum Analytics, Inc.| (default, Dec 20 2016, 23:09:15)
  4. [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
  5. Type "help", "copyright", "credits" or "license" for more information.
  6. Anaconda is brought to you by Continuum Analytics.
  7. Please check out: http://continuum.io/thanks and https://anaconda.org
  8. >>> import tensorflow as tf
  9. >>> hello=tf.constant('hello,Tensorflow')
  10. >>> sess=tf.Session()
  11. 2018-05-04 11:30:18.125746: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
  12. >>> print sess.run(hello)
  13. hello,Tensorflow


   >> import tensorflow as tf

    >>hello=tf.constant('hello,Tensorflow')

    >>sess=tf.Session()

    >>print sess.run(hello)

    --输出hello,Tensorflow表明成功--


阅读(2122) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~