centos 7.3 安装TensorFlow 环境

2230阅读 0评论2018-05-04 月歌54
分类:系统运维

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表明成功--


上一篇:python常见报错
下一篇:mysql 配置文件优化示例