安装指定版本的keras
需要先安装tensorflow, 然后安装keras
pip install tensorflow==1.3.0 -i https://pypi.tuna.tsinghua.edu.cn/simple (-i后面的表示临时指定的国内pip镜像源)
pip install keras==2.0.6 -i https://pypi.tuna.tsinghua.edu.cn/simple
只要两行pip就安装完成了,
其中,注意keras 和tensorflow 的版本需要对应起来, 有一个版本对应表, 详见参考文章
进入python环境,输入import keras,输出Using Tensorflow backend即表示安装成功。
import keras
之后出现警告
FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated.
In future, it will be treated as `np.float64 == np.dtype(float).type`.
from ._conv import register_converters as _register_converters
执行 pip install h5py==2.8.0rc1 -i https://pypi.tuna.tsinghua.edu.cn/simple 完美解决(参考文章)