记一次 Centos7.2 x64 安装 TensorFlow

QQ交流群:64655993 希望能对您有所帮助!!!

1、说明

系统: Centos7.2 x64 

Python版本:2.7.5

中文社区:

http://www.tensorfly.cn/

http://www.tensorfly.cn/tfdoc/get_started/basic_usage.html

2、安装基本工具

[root@localhost ~]# yum install -y epel-release

[root@localhost ~]# yum update -y

(根据网络情况,会需要一定的时间)

[root@localhost ~]# yum install -y vim wget lrzsz rpm zip unzip tree

3、安装 tensorflow

[root@localhost ~]# yum install -y python-pip

[root@localhost ~]# pip install --upgrade pip

[root@localhost ~]# pip install tensorflow

(根据网络情况,会需要一定的时间)

中间部分截图:略。

4、查看tensorflow安装版本和安装地址

[root@localhost ~]# python -c "import tensorflow as tf; print(tf.__version__)"

[root@localhost ~]# python -c "import tensorflow as tf; print(tf.__path__)"

注:此时安装的为最新版本的TensorFlow1.12.0,若想使用旧版本,可以通过如下指令安装: 
pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-x.x.x-cp27-none-linux_x86_64.whl 

5、编写 Hello TensorFlow

代码如下:

>>> import tensorflow as tf
>>> import os
>>> os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
>>> Hello = tf.constant('Hello TensorFlow !')
>>> sess = tf.Session()
>>> print sess.run(Hello)
Hello TensorFlow !

说明:

import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'

是解决下面报错的

tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA

 

TensorFlow1.12.0  安装完毕!

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值