您的位置:首页 > 编程语言 > Python开发

Ubuntu16.04+python3.5+AMD安装tensorflow

2018-03-04 21:14 429 查看

参考: 在 Ubuntu 上安装 TensorFlow (官方文档的翻译)

$ sudo pip  install --upgrade tfBinaryURL   # Python 2.7
$ sudo pip3 install --upgrade tfBinaryURL   # Python 3.n


比如:

sudo pip3 install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.6.0-cp35-cp35m-linux_x86_64.whl[/code] 
其中 tfBinaryURL 标识了 TensorFlow Python 包的 URL。tfBinaryURL 的适当值取决于操作系统、Python 版本和 GPU 。在 这里 找到合适的 tfBinaryURL 值。例如, 要安装 Linux、Python 3.4 和仅支持 CPU 的 TensorFlow。

安装结束后,进行验证:

import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))


比如:

➜  ~ python3
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
/usr/local/lib/python3.5/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
from ._conv import register_converters as _register_converters
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
2018-03-04 21:09:07.730694: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
>>> print(sess.run(hello))
b'Hello, TensorFlow!'
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: