一般安装方法
(1)安装:
sudo apt-get install python-pip python-dev tensorflow
For installing the version with GPU support, please use:
sudo pip install tensorflow-gpu
(2)测试:
$ python
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> sess.run(hello)Hello, TensorFlow!
>>> a = tf.constant(10)
>>> b = tf.constant(32)
>>> sess.run(a+b)42
>>>
利用Anaconda安装
(1)安装Anaconda
sudo bash Anaconda3-4.3.1-Linux-x86_64.sh
(2)建立一个tensorflow的运行环境:
# Python 2.7
$ conda create -n tensorflow Python=2.7
# Python 3.4
$ conda create -n tensorflow Python=3.4
# Python 3.5
$ conda create -n tensorflow Python=3.5
(3)在conda环境中安装tensorflow
pip install tensorflow
For installing the version with GPU support, please use:
sudo pip install tensorflow-gpu
激活conda环境:
$ source activate tensorflow
关闭conda环境:
$ source deactivate tensorflow
PyCharm配置:
方法一:原系统重新添加:点击File->settings->project Interpreter 添加Tensorflow
方法二:在PyCharm中选择Anaconda中Tensorflow的虚拟位置