环境:
win7+vmware
Ubuntu 16.04.3 LTS
Python 2.7.12 (default, Nov 20 2017, 18:23:56)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
正确的安装姿势:
sudo apt-get install python-pip python-dev
很顺利,但是需要更新pip到最新版本.
pip install --upgrade pip
由于国内到国外有大墙(我司有用搬瓦工服务器搭建的shadow vpn),就下载whl安装
安装文件分享出来:http://download.csdn.net/download/yx511500623/10152547
最后:
root@zsj-ubuntn:~# pip install '/root/桌面/tensorflow-0.8.0-cp27-none-linux_x86_64.whl'
Processing ./??/tensorflow-0.8.0-cp27-none-linux_x86_64.whl
Collecting numpy>=1.8.2 (from tensorflow==0.8.0)
Downloading numpy-1.13.3-cp27-cp27mu-manylinux1_x86_64.whl (16.6MB)
100% |████████████████████████████████| 16.7MB 8.3kB/s
Collecting six>=1.10.0 (from tensorflow==0.8.0)
Downloading six-1.11.0-py2.py3-none-any.whl
Collecting protobuf==3.0.0b2 (from tensorflow==0.8.0)
Downloading protobuf-3.0.0b2-py2.py3-none-any.whl (326kB)
100% |████████████████████████████████| 327kB 40kB/s
Requirement already satisfied: wheel in /usr/lib/python2.7/dist-packages (from tensorflow==0.8.0)
Requirement already satisfied: setuptools in /usr/lib/python2.7/dist-packages (from protobuf==3.0.0b2->tensorflow==0.8.0)
Installing collected packages: numpy, six, protobuf, tensorflow
Successfully installed numpy-1.13.3 protobuf-3.0.0b2 six-1.11.0 tensorflow-0.8.0
root@zsj-ubuntn:~#
用tensorflow输出hello world
oot@zsj-ubuntn:~# python
Python 2.7.12 (default, Nov 20 2017, 18:23:56)
[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!
File "<stdin>", line 1
hello =tf.constant(´Hello TensorFlow!
^
SyntaxError: invalid syntax
>>> hello =tf.constant(´Hello TensorFlow!´)
File "<stdin>", line 1
hello =tf.constant(´Hello TensorFlow!´)
^
SyntaxError: invalid syntax
>>> hello =tf.constant(´Hello TensorFlow!´)
File "<stdin>", line 1
hello =tf.constant(´Hello TensorFlow!´)
^
SyntaxError: invalid syntax
>>>
>>> hello =tf.constant('Hello TensorFlow!')
>>> sess=tf.Session()
>>> print sess.rum(hello)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Session' object has no attribute 'rum'
>>> print sess.run(hello)
Hello TensorFlow!
>>> a=ft.constant(10)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'ft' is not defined
>>> a=tf.constant(10)
>>> b=tf.constant(32)
>>> print sess.run(a+b)
42
>>>
折腾了2个晚上才搞定,本来用的centos6 后来下载的ubuntu iso重新安装