您的位置:首页 > 其它

【tensorflow】最新版tensorflow安装

2017-07-13 17:36 239 查看
环境: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
>>>


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: