ubuntu+python基础-3 安装tensorflow踩过的坑
0. sudo apt-get install python-pip python-dev
先安装这两个包
1.对python版本要求比较细致,精细到副版本号,要注意,可以参考https://blog.csdn.net/shuzfan/article/details/78516542
Python 2.7
// CPU版本
pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.4.0-cp27-none-linux_x86_64.whl
// GPU版本
pip install https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.4.0-cp27-none-linux_x86_64.whl
Python 3.4
// CPU版本
pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.4.0-cp34-cp34m-linux_x86_64.whl
// GPU版本
pip install https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.4.0-cp34-cp34m-linux_x86_64.whl
Python 3.5
// CPU版本
pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.4.0-cp35-cp35m-linux_x86_64.whl
// GPU版本
pip install https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.4.0-cp35-cp35m-linux_x86_64.whl
Python 3.6
// CPU版本
pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.4.0-cp36-cp36m-linux_x86_64.whl
// GPU版本
pip install https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.4.0-cp36-cp36m-linux_x86_64.whl2.dd
2.据说GPU版本只支持N卡,不支持A卡(没有验证)
3.下载太慢,可以在system setting->software&updates->ubuntu software->Danwload from->other选择源,找到china,选择一个,清华,中科大对教育网友好,速度比较快,阿里云比较靠谱
4.笔记本下载cpu版就行,gpu版提升效果不大,而且后期使用还要额外配置
5.如果不是在虚拟环境安装,要带上sudo,直接pip会报错。
--------------------------------------------------------------------------------------------------
安装完了pip list 看一下是否有
tensorflow 1.4.0
tensorflow-tensorboard 0.4.0
然后在Terminal中
(vegen3) yc@yc-ubuntu:~/vegen3$ python 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 >>> hello = tf.constant('Hello,TensorFlow!') >>> sess = tf.Session() 2018-04-06 10:24:31.873594: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA >>> print (sess.run(hello)) b'Hello,TensorFlow!'
能显示最后一行表示安装成功