
正文
ubuntu 安装TensorFlow
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
1.安装pip
$ sudo apt-get install python-pip python-dev
2.安装 TensorFlow for Python 2.7
# Ubuntu/Linux -bit, CPU only, Python 2.7:
$ sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whl# Ubuntu/Linux -bit, GPU enabled, Python 2.7. Requires CUDA toolkit 7.5 and CuDNN v4.
# For other versions, see "Install from sources" below.
$ sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whl# Mac OS X, CPU only:
$ sudo easy_install --upgrade six
$ sudo pip install --upgrade https://storage.googleapis.com/tensorflow/mac/tensorflow-0.8.0-py2-none-any.whl
3. 安装 TensorFlow for Python 3.4
# Ubuntu/Linux -bit, CPU only, Python 3.4:
$ sudo pip3 install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0-cp34-cp34m-linux_x86_64.whl# Ubuntu/Linux -bit, GPU enabled, Python 3.4. Requires CUDA toolkit 7.5 and CuDNN v4.
# For other versions, see "Install from sources" below.
$ sudo pip3 install --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.8.0-cp34-cp34m-linux_x86_64.whl# Mac OS X, CPU only:
$ sudo easy_install --upgrade six
$ sudo pip3 install --upgrade https://storage.googleapis.com/tensorflow/mac/tensorflow-0.8.0-py3-none-any.whl
备注:如果之前安装过 TensorFlow < 0.7.1 的版本,应该先使用 pip uninstall 卸载 TensorFlow 和 protobuf ,保证获取的是一个最新 protobuf 依赖下的安装包.
4.测试是否安装成功
$ python
...
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))
Hello, TensorFlow!
>>> a = tf.constant()
>>> b = tf.constant()
>>> print(sess.run(a + b))>>>



![【电子书】[科学技术] 《从机器学习到深度学习: 基于scikit-learn与TensorFlow的高效开发实战》[刘长龙][EPUB] 【电子书】[科学技术] 《从机器学习到深度学习: 基于scikit-learn与TensorFlow的高效开发实战》[刘长龙][EPUB]](https://www.04ip.com/template/qe/style/noimg/7.jpg)




