1、下载并安装anaconda3:使用清华园镜像下载。
清华园镜像: https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/
选择Anaconda3-5.3.1-Windows-x86_64.exe下载
2、添加国内镜像:
打开Anaconda Navigator界面,加入清华大学的镜像源。
地址: https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
3、准备工作:
安装numpy:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple numpy
安装scipy:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple scipy
安装theano:先安装mingw和libpython,再安装theano
conda install mingw libpython
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple theano
4、安装Tensorflow
打开Anaconda Prompt,为了避免错误,先在默认环境下更新所有的包,并在提示是否更新的时候输入 y(Yes)以便让更新继续。
conda upgrade --all
创建一个名为tensorflow的conda环境:
conda create -n tensorflow pip python=3.5.4
激活conda环境:
conda activate tensorflow_envs
安装仅cpu版本,使用命令:
pip install --upgrade --ignore-installed tensorflow下载速度很慢,会提示错误,所以换国内镜像:pip install tensorflow==1.5 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
5、安装Keras
pip install keras==2.1.4 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
6、测试
(1)测试Tensorflow是否安装成功:进入python界面没报错
(2)测试Keras是否安装成功:可以输出keras的版本号