ubuntu14安装tensorflow
- python --version
- wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate
- sudo python get-pip.py
- pip --version
- pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl
1、python2.7版本
- root@baolibin:/# python --version
- Python 2.7.6
- root@baolibin:/#
2、安装pip
- root@baolibin:/# wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate
- --2016-10-18 23:09:54-- https://bootstrap.pypa.io/get-pip.py
- 正在解析主机 bootstrap.pypa.io (bootstrap.pypa.io)... 151.101.36.175
- 正在连接 bootstrap.pypa.io (bootstrap.pypa.io)|151.101.36.175|:443... 已连接。
- 已发出 HTTP 请求,正在等待回应... 200 OK
- 长度: 1524722 (1.5M) [text/x-python]
- 正在保存至: “get-pip.py”
- 100%[===============================================================================================>] 1,524,722 5.73KB/s 用时 11m 0s
- 2016-10-18 23:20:58 (2.25 KB/s) - 已保存 “get-pip.py” [1524722/1524722])
- root@baolibin:/#
- root@baolibin:/# sudo python get-pip.py
- Collecting pip
- /tmp/tmpbahmxa/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made,but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate,which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information,see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
- /tmp/tmpbahmxa/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information,see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
- Downloading pip-8.1.2-py2.py3-none-any.whl (1.2MB)
- 100% |████████████████████████████████| 1.2MB 14kB/s
- Collecting setuptools
- Downloading setuptools-28.6.0-py2.py3-none-any.whl (471kB)
- 100% |████████████████████████████████| 481kB 13kB/s
- Collecting wheel
- Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
- 100% |████████████████████████████████| 71kB 20kB/s
- Installing collected packages: pip,setuptools,wheel
- Successfully installed pip-8.1.2 setuptools-28.6.0 wheel-0.29.0
- /tmp/tmpbahmxa/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information,see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
- root@baolibin:/#
3、pip版本
- root@baolibin:/# pip --version
- pip 8.1.2 from /usr/local/lib/python2.7/dist-packages (python 2.7)
- root@baolibin:/#
4、安装tensoflow
- root@baolibin:/# pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl
- Collecting tensorflow==0.5.0 from https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl
- /usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made,see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
- SNIMissingWarning
- /usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information,see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
- InsecurePlatformWarning
- Downloading https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl (10.9MB)
- 100% |████████████████████████████████| 10.9MB 81kB/s
- Collecting numpy>=1.9.2 (from tensorflow==0.5.0)
- /usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information,see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
- InsecurePlatformWarning
- Downloading numpy-1.11.2-cp27-cp27mu-manylinux1_x86_64.whl (15.3MB)
- 100% |████████████████████████████████| 15.3MB 47kB/s
- Collecting six>=1.10.0 (from tensorflow==0.5.0)
- Downloading six-1.10.0-py2.py3-none-any.whl
- Installing collected packages: numpy,six,tensorflow
- Found existing installation: six 1.5.2
- DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
- Uninstalling six-1.5.2:
- Successfully uninstalled six-1.5.2
- Successfully installed numpy-1.11.2 six-1.10.0 tensorflow-0.5.0
- root@baolibin:/#
5、运行tensorflow
- root@baolibin:/# python
- Python 2.7.6 (default,Jun 22 2015,17:58:13)
- [GCC 4.8.2] on linux2
- Type "help","copyright","credits" or "license" for more information.
- >>> import tensorflow as tf
- >>> hello = tf.constant('hello tensorflow')
- >>> sess=tf.Session()
- I tensorflow/core/common_runtime/local_device.cc:25] Local device intra op parallelism threads: 4
- I tensorflow/core/common_runtime/local_session.cc:45] Local session inter op parallelism threads: 4
- >>> print sess.run(hello)
- hello tensorflow
- >>> a=tf.constant(10)
- >>> b=tf.constant(23)
- >>> print sess.run(a+b)
- 33
- >>> quit()