1、安装依赖包:
-
[root@localhost ~]#yum install wget gcc gcc-devel glibc glibc-devel gzip2 -y
2、下载Anaconda:
-
[root@localhost ~]#wget rs.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda2-2.5.0-Linux-x86_64.sh --no-check-certificate
-
3、安装Anaconda
-
[root@localhost ~]# bash Anaconda2-2.5.0-Linux-x86_64.sh
安装提示中anaconda2 安装目录选/srv/anaconda2
4、配置anaconda2环境变量为/srv/anaconda2
-
[root@localhost ~]# vi ~/.bashrc #追加以下行
-
export PATH=/srv/anaconda2/bin:$PATH
-
[root@localhost ~]# source ~/.bashrc
-
5、安装TensorFlow
-
[root@localhost ~]#conda create -n tensorflow python=2.7
-
[root@localhost ~]#conda install -c conda-forge tensorflow
-
[root@localhost ~]#source activate tensorflow
-
[root@localhost ~]#pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow
6、验证
进入python
-
[root@ulife3 ~]# source activate tensorflow
-
(tensorflow) [root@ulife3 ~]# python
-
Python 2.7.13 |Continuum Analytics, Inc.| (default, Dec 20 2016, 23:09:15)
-
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
-
Type "help", "copyright", "credits" or "license" for more information.
-
Anaconda is brought to you by Continuum Analytics.
-
Please check out: http://continuum.io/thanks and https://anaconda.org
-
>>> import tensorflow as tf
-
>>> hello=tf.constant('hello,Tensorflow')
-
>>> sess=tf.Session()
-
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
-
>>> print sess.run(hello)
-
hello,Tensorflow
>> import tensorflow as tf
>>hello=tf.constant('hello,Tensorflow')
>>sess=tf.Session()
>>print sess.run(hello)
--输出hello,Tensorflow表明成功--
阅读(2177) | 评论(0) | 转发(0) |