tensorflow 环境搭建(centos与windows)


1. windows下安装

建议基于anaconda安装. 参见 <<tensorflow (win10 & cuda &anaconda )安装>>.  http://blog.csdn.net/chuchus/article/details/77184566

2. centos下安装

按顺序一步一步解决依赖并安装。

1.1 python

笔者使用的版本为2.7.5 .

2.1 python-pip

pip,Python Index Package。类似linux下的yum,安装并管理python软件包。
pip安装命令: yum install  python-pip python-devel
备注:不安装python-devel的话,pynum安装就会报错。这是一个py下的数学计算扩展包。

3.1 tensorflow

终于开始安装它本身了。

tensorflow 安装命令:pip install  https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.6.0-cp27-none-linux_x86_64.whl

安装之后的升级命令: pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.6.0-cp27-none-linux_x86_64.whl

安装过程需要持续近10分钟,因为有大量的编译工作。


3.测试安装成功与否

#tensorflowTest.py
import tensorflow as tf
hello = tf.constant('Hello,TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
a = tf.constant(10)
b = tf.constant(32)
print(sess.run(a + b))
运行 python tensorflowTest.py ,若最终结果与下面两行一致,则恭喜你安装成功!附运行结果的截图,见图4-1.
//TensorFlow.py 运行结果
Hello, TensorFlow!
42

图3-1 linux下tensflow运行成功, windows也一样

4. 常见问题

运行的时候会有下面的警告信息输出, 但程序仍能运行.
大致原因是pip安装的是预编译 tensorflow 库, 没有针对当前的cpu体系进行优化.
2017-05-05 11:18:58.162500: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE instructions, but these are available on your machine and could speed up CPU computations.
2017-05-05 11:18:58.162995: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE2 instructions, but these are available on your machine and could speed up CPU computations.
2017-05-05 11:18:58.163347: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations.
2017-05-05 11:18:58.164001: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2017-05-05 11:18:58.164352: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-05-05 11:18:58.164699: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2017-05-05 11:18:58.165029: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2017-05-05 11:18:58.165292: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值