系统硬件设备
笔者的显卡是Tesla K40m,显存12g,cuda版本是8.0,python版本是3.6,基于以上信息安装的tensorflow。
安装血泪史
由于笔者要安装的是gpu版,因此采用的下述方法:
conda create -n tensorflow python=3.6 # or python=2.7, etc. source activate tensorflow pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.3.0-cp36-cp36m-linux_x86_64.whl |
在安装时,之前选择的tensorflow版本是1.7.0最新版,但是发现他需要cuda的版本是9.0,因此果断放弃最新版,退回1.3.0,之后便可正常使用。
这里给出测试样例:
# Python
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
参考博客
ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory解决方案
module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.6问题解决