Keras之linux安装及问题解决

  • 安装是以theano为后端
  • 所选系统为Centos6 32位
  1. 安装需要的包
conda install numpy scipy mkl <nose> <sphinx> <pydot-ng>
#<...>为可选的包
pip install parameterized
  1. GPU加速器没有安装,不过安装需要下载GPU下载
  2. Stable Installation
conda install theano pygpu
&
pip install  Theano
  • libgpuarray
git clone https://github.com/Theano/libgpuarray.git
cd libgpuarray
git checkout tags/v0.6.5 -b v0.6.9
  • Bleeding-Edge Installation (recommended)
pip install <--user> <--no-deps> git+https://github.com/Theano/Theano.git#egg=Theano
  • libgpuarray
conda install -c mila-udem pygpu
  • Developer Installation
git clone git://github.com/Theano/Theano.git
cd Theano
<sudo> pip install <--user> <--no-deps> -e 
sudo yum install python-devel python-nose python-setuptools gcc gcc-gfortran gcc-c++ blas-devel lapack-devel atlas-devel
sudo easy_install pip
  • Keras框架搭建
pip install -U --pre pip setuptools wheel
pip install -U --pre numpy scipy matplotlib scikit-learn scikit-image
pip install -U --pre tensorflow-gpu #可能执行不成功,没关系继续执行
pip install -U --pre keras

安装完毕后,输入python,然后输入:

>> import tensorflow
>> import keras

无错输出即可

  • Keras中mnist数据集测试 下载Keras开发包
>>> git clone https://github.com/fchollet/keras.git
>>> cd keras/examples/
>>> python mnist_mlp.py

程序无错进行,至此,keras安装完成

猜你喜欢

转载自my.oschina.net/112612/blog/1617140