1.本机系统:16.04.1-Ubuntu
2.python版本:
Python 2.7.12 (default, Mar 1 2021, 11:38:31)
[GCC 5.4.0 20160609] on linux2
3.sudo apt-get install python-pip python-dev
4.sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whl
安装提示:
The directory '/home/jilijili/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/jilijili/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting tensorflow==0.8.0 from https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whl
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='storage.googleapis.com', port=443): Read timed out. (read timeout=15)",)': /tensorflow/linux/cpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whl
Downloading https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whl (22.2MB)
100% |████████████████████████████████| 22.2MB 58kB/s
Collecting wheel (from tensorflow==0.8.0)
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', error(104, '\xe8\xbf\x9e\xe6\x8e\xa5\xe8\xa2\xab\xe5\xaf\xb9\xe6\x96\xb9\xe9\x87\x8d\xe8\xae\xbe'))': /packages/65/63/39d04c74222770ed1589c0eaba06c05891801219272420b40311cd60c880/wheel-0.36.2-py2.py3-none-any.whl
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', error(104, '\xe8\xbf\x9e\xe6\x8e\xa5\xe8\xa2\xab\xe5\xaf\xb9\xe6\x96\xb9\xe9\x87\x8d\xe8\xae\xbe'))': /packages/65/63/39d04c74222770ed1589c0eaba06c05891801219272420b40311cd60c880/wheel-0.36.2-py2.py3-none-any.whl
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', error(104, '\xe8\xbf\x9e\xe6\x8e\xa5\xe8\xa2\xab\xe5\xaf\xb9\xe6\x96\xb9\xe9\x87\x8d\xe8\xae\xbe'))': /packages/65/63/39d04c74222770ed1589c0eaba06c05891801219272420b40311cd60c880/wheel-0.36.2-py2.py3-none-any.whl
Downloading https://files.pythonhosted.org/packages/65/63/39d04c74222770ed1589c0eaba06c05891801219272420b40311cd60c880/wheel-0.36.2-py2.py3-none-any.whl
Collecting protobuf==3.0.0b2 (from tensorflow==0.8.0)
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', error(104, '\xe8\xbf\x9e\xe6\x8e\xa5\xe8\xa2\xab\xe5\xaf\xb9\xe6\x96\xb9\xe9\x87\x8d\xe8\xae\xbe'))': /simple/protobuf/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', error(104, '\xe8\xbf\x9e\xe6\x8e\xa5\xe8\xa2\xab\xe5\xaf\xb9\xe6\x96\xb9\xe9\x87\x8d\xe8\xae\xbe'))': /simple/protobuf/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', error(104, '\xe8\xbf\x9e\xe6\x8e\xa5\xe8\xa2\xab\xe5\xaf\xb9\xe6\x96\xb9\xe9\x87\x8d\xe8\xae\xbe'))': /simple/protobuf/
Downloading https://files.pythonhosted.org/packages/00/8e/9a3feb39d464eb7aacc108e6e6e1f2368ec741821486964c4cd0f41baabb/protobuf-3.0.0b2-py2.py3-none-any.whl (326kB)
100% |████████████████████████████████| 327kB 835kB/s
Collecting six>=1.10.0 (from tensorflow==0.8.0)
Downloading https://files.pythonhosted.org/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl
Requirement already up-to-date: numpy>=1.8.2 in ./.local/lib/python2.7/site-packages (from tensorflow==0.8.0)
Requirement already up-to-date: setuptools in ./.local/lib/python2.7/site-packages (from protobuf==3.0.0b2->tensorflow==0.8.0)
Installing collected packages: wheel, six, protobuf, tensorflow
Found existing installation: wheel 0.30.0
Not uninstalling wheel at /usr/lib/python2.7/dist-packages, outside environment /usr
Found existing installation: six 1.15.0
Uninstalling six-1.15.0:
Successfully uninstalled six-1.15.0
Successfully installed protobuf-3.0.0b2 six-1.16.0 tensorflow-0.8.0 wheel-0.36.2
5.安装numpy: sudo apt-get install python-numpy
6.安装scipy:sudo apt-get install python-scipy
7.安装matplotlib:sudo apt-get install python-matplotlib
8.测试使用:
jilijili@jilijili:~/jili/tensorflow$ python
Python 2.7.12 (default, Mar 1 2021, 11:38:31)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> import numpy
>>> import scipy
>>> import matplotlib
>>> hello = tf.constant('Hello, TensorFlow!')
>>> session = tf.Session()
>>> print(session.run(hello))
Hello, TensorFlow!
>>> x = tf.constant(50)
>>> y = tf.constant(31)
>>> print(session.run(x + y))
81
>>> quit()