本机ubuntu16.04自带Python2.7.13,已安装anaconda:
开始安装:
1. 建立 conda 计算环境
conda create -n tensorflow python=2.7
中间 Proceed([y]/n)? 选 y
2. 激活环境,使用 conda 安装
source activate tensorflow
中间 Proceed([y]/n)? 选 y
结果报错………….
3. 查看conda list
运行
conda list
4. 安装TensorFlow
运行
conda install tensorflow
安装成功:
测试:
import tensorflow as tf
mat1 = tf.constant([[3., 4.]])
mat2 = tf.constant([[1.], [2.]])
product = tf.matmul(mat1, mat2)
sess = tf.Session()
result = sess.run(product)
print result
sess.close()
输出:
[[ 11.]]
伴有警告:
tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
=======================================
TensorFlow库未编译为使用SSE4.1指令,但这些指令可在您的计算机上使用,并可加速CPU计算。
<只是警告,尚未找到消除方法….有解决方法的兄台可在评论里告知,感谢>