Ubuntu 18.04.1 LTS/python2.7/pip/tensorflow-0.8.0-cp27-none-linux_x86_64
Ubuntu 18.04.1 LTS/python2.7/pip/tensorflow-0.8.0-cp27-none-linux_x86_64
2019年02月20日 20:45:36 hushui 阅读数:1 标签: tensorflow python 更多
个人分类: Ubuntu Python tensorflow
编辑
版权声明:hushui版权所有 https://blog.csdn.net/hushui/article/details/87821701
Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-29-generic x86_64)
lake@lake-Latitude-5491:~$ python
python python2-config python3.6m python3m-config
python2 python3 python3.6m-config python-config
python2.7 python3.6 python3-config
python2.7-config python3.6-config python3m
lake@lake-Latitude-5491:~$ which python
/usr/bin/python
lake@lake-Latitude-5491:~$ ls -l /usr/bin/python
lrwxrwxrwx 1 root root 9 Apr 16 2018 /usr/bin/python -> python2.7
lake@lake-Latitude-5491:~$ ls -l /usr/bin/python2
lrwxrwxrwx 1 root root 9 Apr 16 2018 /usr/bin/python2 -> python2.7
lake@lake-Latitude-5491:~$ ls -l /usr/bin/python3
lrwxrwxrwx 1 root root 9 Oct 25 19:11 /usr/bin/python3 -> python3.6
lake@lake-Latitude-5491:~$ sudo apt-get install python-pip python-dev
[sudo] password for lake:
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-dev is already the newest version (2.7.15~rc1-1).
python-dev set to manually installed.
python-pip is already the newest version (9.0.1-2.3~ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 325 not upgraded.
lake@lake-Latitude-5491:~$ sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whl
The directory '/home/lake/.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/lake/.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
^COperation cancelled by user
############################################
## let pip to choose the right version of protobuf when install tensorflow
pip uninstall protobuf
############################################
lake@lake-Latitude-5491:~$ pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whl
Collecting tensorflow==0.8.0 from https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whl
..................
ConnectionError: HTTPSConnectionPool(host='storage.googleapis.com', port=443): Max retries exceeded with url: /tensorflow/linux/cpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whl (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f06ff26ad10>: Failed to establish a new connection: [Errno 101] Network is unreachable',))
lake@lake-Latitude-5491:~$ declare -x HTTP_PROXY="http://192.168.1.4:8580"
lake@lake-Latitude-5491:~$ declare -x HTTPS_PROXY="http://192.168.1.4:8580"
lake@lake-Latitude-5491:~$ declare -x http_proxy="http://192.168.1.4:8580"
lake@lake-Latitude-5491:~$ pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whl
Collecting tensorflow==0.8.0 from https://storage.googleapis.com/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 65kB/s
Collecting six>=1.10.0 (from tensorflow==0.8.0)
Using cached https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting numpy>=1.8.2 (from tensorflow==0.8.0)
Using cached https://files.pythonhosted.org/packages/e0/b5/63b79fe426433fa1cd110eb04a94ec0c6967e56e5f57c98caf455a5fb6e2/numpy-1.16.1-cp27-cp27mu-manylinux1_x86_64.whl
Collecting wheel (from tensorflow==0.8.0)
Downloading https://files.pythonhosted.org/packages/96/ba/a4702cbb6a3a485239fbe9525443446203f00771af9ac000fa3ef2788201/wheel-0.33.1-py2.py3-none-any.whl
Collecting protobuf==3.0.0b2 (from tensorflow==0.8.0)
Downloading https://files.pythonhosted.org/packages/00/8e/9a3feb39d464eb7aacc108e6e6e1f2368ec741821486964c4cd0f41baabb/protobuf-3.0.0b2-py2.py3-none-any.whl (326kB)
100% |████████████████████████████████| 327kB 262kB/s
Collecting setuptools (from protobuf==3.0.0b2->tensorflow==0.8.0)
Downloading https://files.pythonhosted.org/packages/d1/6a/4b2fcefd2ea0868810e92d519dacac1ddc64a2e53ba9e3422c3b62b378a6/setuptools-40.8.0-py2.py3-none-any.whl (575kB)
100% |████████████████████████████████| 583kB 218kB/s
Installing collected packages: six, numpy, wheel, setuptools, protobuf, tensorflow
Successfully installed numpy-1.16.1 protobuf-3.0.0b2 setuptools-40.8.0 six-1.12.0 tensorflow-0.8.0 wheel-0.33.1
########### Test in Python
lake@lake-Latitude-5491:~$ python
Python 2.7.15rc1 (default, Nov 12 2018, 14:31:15)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print sess.run(hello)
Hello, TensorFlow!
>>> a = tf.constant(10)
>>> b = tf.constant(32)
>>> rint sess.run(a+b)
File "<stdin>", line 1
rint sess.run(a+b)
^
SyntaxError: invalid syntax
>>> print sess.run(a+b)
42
>>>