一、版本配套

  Ubuntu 16.04 LTS + Python 2.7 

  参考链接:

  https://blog.csdn.net/cxq234843654/article/details/70857562/

       https://blog.csdn.net/y1250056491/article/details/78670710/

二、安装过程

root@ubuntu:~/p4# pip install tensorflow
Collecting tensorflow
Downloading https://files.pythonhosted.org/packages/1a/c4/8cb95df0bf06089014259b25997c3921a87aa08e2cd981417d91ca92f7e9/tensorflow-1.10.1-cp27-cp27mu-manylinux1_x86_64.whl (58.4MB)
100% |████████████████████████████████| 58.4MB 10kB/s 
Collecting numpy<=1.14.5,>=1.13.3 (from tensorflow)
Downloading https://files.pythonhosted.org/packages/6a/a9/c01a2d5f7b045f508c8cefef3b079fe8c413d05498ca0ae877cffa230564/numpy-1.14.5-cp27-cp27mu-manylinux1_x86_64.whl (12.1MB)
100% |████████████████████████████████| 12.1MB 74kB/s 
Collecting grpcio>=1.8.6 (from tensorflow)
Downloading https://files.pythonhosted.org/packages/b5/84/c0d0a0355f2e3ea1e49fd81aa123e0bf42bfaa58be56583cc3b9baaf2837/grpcio-1.14.1-cp27-cp27mu-manylinux1_x86_64.whl (9.2MB)
100% |████████████████████████████████| 9.2MB 153kB/s 
Collecting protobuf>=3.6.0 (from tensorflow)
Downloading https://files.pythonhosted.org/packages/b8/c2/b7f587c0aaf8bf2201405e8162323037fe8d17aa21d3c7dda811b8d01469/protobuf-3.6.1-cp27-cp27mu-manylinux1_x86_64.whl (1.1MB)
100% |████████████████████████████████| 1.1MB 699kB/s 
Collecting mock>=2.0.0 (from tensorflow)
Downloading https://files.pythonhosted.org/packages/e6/35/f187bdf23be87092bd0f1200d43d23076cee4d0dec109f195173fd3ebc79/mock-2.0.0-py2.py3-none-any.whl (56kB)
100% |████████████████████████████████| 61kB 1.0MB/s 
Collecting termcolor>=1.1.0 (from tensorflow)
Downloading https://files.pythonhosted.org/packages/8a/48/a76be51647d0eb9f10e2a4511bf3ffb8cc1e6b14e9e4fab46173aa79f981/termcolor-1.1.0.tar.gz
Collecting backports.weakref>=1.0rc1 (from tensorflow)
Downloading https://files.pythonhosted.org/packages/88/ec/f598b633c3d5ffe267aaada57d961c94fdfa183c5c3ebda2b6d151943db6/backports.weakref-1.0.post1-py2.py3-none-any.whl
Collecting absl-py>=0.1.6 (from tensorflow)
Downloading https://files.pythonhosted.org/packages/a7/86/67f55488ec68982270142c340cd23cd2408835dc4b24bd1d1f1e114f24c3/absl-py-0.4.1.tar.gz (88kB)
100% |████████████████████████████████| 92kB 1.6MB/s 
Requirement already satisfied (use --upgrade to upgrade): wheel in /usr/lib/python2.7/dist-packages (from tensorflow)
Collecting tensorboard<1.11.0,>=1.10.0 (from tensorflow)
Downloading https://files.pythonhosted.org/packages/e0/11/8ac6a52179a290a249f80cb6e157f1bb1f87a7e44dba8a0869701d8076cb/tensorboard-1.10.0-py2-none-any.whl (3.3MB)
100% |████████████████████████████████| 3.3MB 354kB/s 
Requirement already satisfied (use --upgrade to upgrade): six>=1.10.0 in /usr/lib/python2.7/dist-packages (from tensorflow)
Collecting gast>=0.2.0 (from tensorflow)
Downloading https://files.pythonhosted.org/packages/5c/78/ff794fcae2ce8aa6323e789d1f8b3b7765f601e7702726f430e814822b96/gast-0.2.0.tar.gz
Collecting enum34>=1.1.6 (from tensorflow)
Downloading https://files.pythonhosted.org/packages/c5/db/e56e6b4bbac7c4a06de1c50de6fe1ef3810018ae11732a50f15f62c7d050/enum34-1.1.6-py2-none-any.whl
Collecting astor>=0.6.0 (from tensorflow)
Downloading https://files.pythonhosted.org/packages/35/6b/11530768cac581a12952a2aad00e1526b89d242d0b9f59534ef6e6a1752f/astor-0.7.1-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): setuptools<=39.1.0 in /usr/lib/python2.7/dist-packages (from tensorflow)
Collecting futures>=2.2.0 (from grpcio>=1.8.6->tensorflow)
Downloading https://files.pythonhosted.org/packages/2d/99/b2c4e9d5a30f6471e410a146232b4118e697fa3ffc06d6a65efde84debd0/futures-3.2.0-py2-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): funcsigs>=1; python_version < "3.3" in /usr/local/lib/python2.7/dist-packages (from mock>=2.0.0->tensorflow)
Requirement already satisfied (use --upgrade to upgrade): pbr>=0.11 in /usr/local/lib/python2.7/dist-packages (from mock>=2.0.0->tensorflow)
Collecting markdown>=2.6.8 (from tensorboard<1.11.0,>=1.10.0->tensorflow)
Downloading https://files.pythonhosted.org/packages/6d/7d/488b90f470b96531a3f5788cf12a93332f543dbab13c423a5e7ce96a0493/Markdown-2.6.11-py2.py3-none-any.whl (78kB)
100% |████████████████████████████████| 81kB 1.2MB/s 
Collecting werkzeug>=0.11.10 (from tensorboard<1.11.0,>=1.10.0->tensorflow)
Downloading https://files.pythonhosted.org/packages/20/c4/12e3e56473e52375aa29c4764e70d1b8f3efa6682bef8d0aae04fe335243/Werkzeug-0.14.1-py2.py3-none-any.whl (322kB)
100% |████████████████████████████████| 327kB 934kB/s 
Building wheels for collected packages: termcolor, absl-py, gast
Running setup.py bdist_wheel for termcolor ... done
Stored in directory: /root/.cache/pip/wheels/7c/06/54/bc84598ba1daf8f970247f550b175aaaee85f68b4b0c5ab2c6
Running setup.py bdist_wheel for absl-py ... done
Stored in directory: /root/.cache/pip/wheels/78/a3/a3/689120b95c26b9a21be6584b4b482b0fda0a1b60efd30af558
Running setup.py bdist_wheel for gast ... done
Stored in directory: /root/.cache/pip/wheels/9a/1f/0e/3cde98113222b853e98fc0a8e9924480a3e25f1b4008cedb4f
Successfully built termcolor absl-py gast
Installing collected packages: numpy, futures, enum34, grpcio, protobuf, mock, termcolor, backports.weakref, absl-py, markdown, werkzeug, tensorboard, gast, astor, tensorflow
Found existing installation: enum34 1.1.2
Not uninstalling enum34 at /usr/lib/python2.7/dist-packages, outside environment /usr
Found existing installation: mock 1.3.0
Not uninstalling mock at /usr/lib/python2.7/dist-packages, outside environment /usr
Successfully installed absl-py-0.4.1 astor-0.7.1 backports.weakref-1.0.post1 enum34-1.1.2 futures-3.2.0 gast-0.2.0 grpcio-1.14.1 markdown-2.6.11 mock-1.3.0 numpy-1.14.5 protobuf-3.6.1 tensorboard-1.10.0 tensorflow-1.10.1 termcolor-1.1.0 werkzeug-0.14.1
You are using pip version 8.1.1, however version 18.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.


 

  

 三、验证安装是否成功 

root@ubuntu:~# python
Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
2018-08-30 00:56:00.431792: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
>>> print(sess.run(hello))
Hello, TensorFlow!
>>>

  

 

posted on 2018-09-07 16:57  水共禾刀  阅读(1230)  评论(0编辑  收藏  举报