参考:
0.准备工作
本教程基于Adaconda来安装TensorFlow,在Windows/Linux上步骤一样。所以首先应该安装好Adaconda,去官网下载地址 下载之后就是普通的软件安装过程了。
1.正式安装
1.1 创建虚拟环境 tensorflow ,方便版本控制,当然也可以不创建,但推荐创建虚拟环境。打开“Adaconda Prompt”,输入以下命令
conda create -n tensorflow_env python=3.6
1.2 激活虚拟环境
activate tensorflow_env
1.3 【核心】使用pip安装TensorFlow
pip install --upgrade tensorflow
基本上到这一步装完就完事儿了,但是有的机器可能不行,那这个时候可以使用全路径安装,命令行如下:
pip install --ignore-installed --upgrade packageURL
packageURL表如下
Version | URL |
---|---|
Linux | |
Python 2.7 CPU-only | https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.11.0-cp27-none-linux_x86_64.whl |
Python 2.7 GPU support | https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.11.0-cp27-none-linux_x86_64.whl |
Python 3.4 CPU-only | https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.11.0-cp34-cp34m-linux_x86_64.whl |
Python 3.4 GPU support | https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.11.0-cp34-cp34m-linux_x86_64.whl |
Python 3.5 CPU-only | https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.11.0-cp35-cp35m-linux_x86_64.whl |
Python 3.5 GPU support | https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.11.0-cp35-cp35m-linux_x86_64.whl |
Python 3.6 CPU-only | https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.11.0-cp36-cp36m-linux_x86_64.whl |
Python 3.6 GPU support | https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.11.0-cp36-cp36m-linux_x86_64.whl |
macOS (CPU-only) | |
Python 2.7 | https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.11.0-py2-none-any.whl |
Python 3.4, 3.5, 3.6 | https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.11.0-py3-none-any.whl |
Windows | |
Python 3.5 CPU-only | https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.11.0-cp35-cp35m-win_amd64.whl |
Python 3.5 GPU support | https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.11.0-cp35-cp35m-win_amd64.whl |
Python 3.6 CPU-only | https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.11.0-cp36-cp36m-win_amd64.whl |
Python 3.6 GPU support | https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.11.0-cp36-cp36m-win_amd64.whl |
1.4 测试一下
python /*进入python环境*/
>>> import numpy
>>> import tensorflow as tf
>>> tf.__version__
输出为:
'1.11.0'
【完】