【tensorflow】最新版tensorflow安装

环境:ubuntu 16.4.2          python 3.5.2


ubuntu 16.4.2上的python默认使用的2.7的版本,设置默认使用3.5版本

sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150

安装pip3工具

sudo apt install python3-pip

进入github的tensorflow首页 https://github.com/tensorflow/tensorflow,点击对应环境下的编译历史
这里写图片描述

下载编译好的二进制文件,目前是1.2.1版本
tensorflow-1.2.1-cp35-cp35m-linux_x86_64.whl

安装tensorflow

pip3 install --ignore-installed tensorflow-1.2.1-cp35-cp35m-linux_x86_64.whl 

设置tensorflow的log信息打印等级

vim /etc/profile

最后一行追加

#set tensorflow log`s level
export TF_CPP_MIN_LOG_LEVEL=3

使之生效

source /etc/profile

测试

$ python
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> sess.run(hello)
'Hello, TensorFlow!'
>>> a = tf.constant(10)
>>> b = tf.constant(32)
>>> sess.run(a+b)
42
>>>

这里写图片描述

扫描二维码关注公众号,回复: 2768851 查看本文章

猜你喜欢

转载自blog.csdn.net/u012819339/article/details/75086501