在计算机上简便安装tensorflow教程

第一次学习了解tensorflow的话,推介使用pip方式安装,因为源码安装会很复杂,可能出一些问题

如果你的电脑没有之前配置CUDA gpu支持环境,那么使用该指令安装CPU版:(如报错没有安装pip,按照提示安装即可)

pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl

如果你的电脑之前已经安装好了gpu使用环境,并成功的用过几调用个GPU的历程,使用该指令安装:

pip install https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl


接下来就可以测试你安装的tensorflow了:

$ python

>>> 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)
>>> print sess.run(a+b)
42
>>>

猜你喜欢

转载自blog.csdn.net/qq_35379989/article/details/80115722