安装Keras

安装Keras之前需要先安装Tensorflow:

step 1. 首先下载安装python 3.5.2版本(tensorflow对3.5.x版本支持较好)

step 2. 直接pip install tensorflow会安装最新版本(1.7.0)的tensorflow,安装后测试时报错了,后来试着安装低版本的cpu 1.2.0版本,安装成功,方法:

cpu 1.2.0版本:pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.2.0-cp35-cp35m-win_amd64.whl (实验过,成功)  

gpu 1.2.0版本:pip install https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow-1.2.0-cp35-cp35m-win_amd64.whl

测试是否安装成功:

cmd输入 python,回车,然后

>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))

如果能正常输出hello字符串,则安装成功。

     Hello, TensorFlow!

step 3. 安装keras: pip install keras -U --pre

posted @ 2018-04-17 18:39  morein2008  阅读(216)  评论(0编辑  收藏  举报