Linux的安装
1.下载Anaconda 4.4.0,最牛B的机器学习库、
wget https://repo.continuum.io/archive/Anaconda2-4.4.0-Linux-x86_64.sh
2.bash Anaconda2-4.4.0-Linux-x86_64.sh //会自动安装python2.7的版本
中文版:https://repo.continuum.io/archive/Anaconda3-4.4.0-Windows-x86_64.exe,python3.6
3.conda create -n tensorflow python=2.7,创建新的环境
conda remove -b tensorflow --all,删除环境
4.source activate tensorflow 激活新环境
source deactivate tensorflow 禁用环境
5.安装tensorflow
pip install --trusted-host pypi.douban.com --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.2.1-cp27-none-linux_x86_64.whl
中文
pip install --trusted-host pypi.douban.com --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.2.1-cp36-cp36m-win_amd64.whl
pip install --trusted-host pypi.douban.com --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow_gpu-1.2.1-cp36-cp36m-win_amd64.whl
注:--trusted-host pypi.douban.com,在失败时,根据提示增加或修改该项
----------------
注:https://storage.googleapis.com/tensorflow/在该页面搜索“-cp27-none-linux_x86_64.whl”的最新版本
----------------------------------
报错:/lib64/libc.so.6: version `GLIBC_2.14'版本时,请到http://www.gnu.org/software/libc/中查找相应的版本进行安装
Window的安装
Installing with Anaconda
The Anaconda installation is community supported, not officially supported.
Take the following steps to install TensorFlow in an Anaconda environment:
Follow the instructions on the Anaconda download site to download and install Anaconda.
Create a conda environment named tensorflow by invoking the following command:
C:> conda create -n tensorflow python=3.5
Activate the conda environment by issuing the following command:
C:> activate tensorflow
(tensorflow)C:> # Your prompt should change
Issue the appropriate command to install TensorFlow inside your conda environment. To install the CPU-only version of TensorFlow, enter the following command:
(tensorflow)C:> pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.2.1-cp35-cp35m-win_amd64.whl
To install the GPU version of TensorFlow, enter the following command (on a single line):
(tensorflow)C:> pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.2.1-cp35-cp35m-win_amd64.whl
Validate your installation
Start a terminal.
If you installed through Anaconda, activate your Anaconda environment.
Invoke python from your shell as follows:
$ python
Enter the following short program inside the python interactive shell:
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))
If the system outputs the following, then you are ready to begin writing TensorFlow programs:
Hello, TensorFlow!
If you are new to TensorFlow, see Getting Started with TensorFlow.
If the system outputs an error message instead of a greeting, see Common installation problems.