Ubuntu&Windows安装TensorFlow

前端之家收集整理的这篇文章主要介绍了Ubuntu&Windows安装TensorFlow前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

以下安装过程不涉及网络加速工具

Ubuntu完整安装过程

安装python

$ sudo apt-get install python
$ sudo apt-get install python-pip python-numpy python-dev

pip安装tensorflow

# 仅cpu版本
$ sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.1-cp27-none-linux_x86_64.whl

# 开启GPU支持的版本
$ sudo pip install https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-1.0.1-cp27-none-linux_x86_64.whl

Windows 完整安装过程

安装python

点此下载Python3

安装tensorflow

# cpu版本
pip install https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.0.1-cp35-cp35m-win_amd64.whl

# GPU版本
pip install https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.0.1-cp35-cp35m-win_amd64.whl

测试TensorFlow

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

猜你在找的Ubuntu相关文章