CentOS6.8部署Keras环境

时间:2021-11-29 13:56:39

一.升级python到2.7.3版本

1)安装依赖库

yum -y update

yum groupinstall -y development

yum install -y zlib-dev openssl-devel sqlite-devel bzip2-devel

2)安装pyhon 2.7.3

wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tar.xz

tar -xvf Python-2.7.3.tar.xz

cd Python-2.7.3

编译之前需要删掉Object目录下所有的.o文件(参考http://blog.csdn.net/zhouyongsdzh/article/details/24449645)

./configure --prefix=/usr/local/  –enable-shared CFLAGS=-fPIC 

make && make altinstall

mv /usr/bin/python /usr/bin/python2.6.6

ln -s /usr/local/bin/python2.7.3 /usr/bin/python

vi /usr/bin/yum(#!/usr/bin/python 改为 #!/usr/bin/python2.6.6)

3)安装setup tool工具

wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-1.4.2.tar.gz

tar -xvf setuptools-1.4.2.tar.gz

cd setuptools-1.4.2

python setup.py install

4)安装pip​

ln -s /usr/local/bin/easy_install-2.7 /usr/bin/easy_install

easy_install pip

curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python2.7

yum -y install libxslt-devel

yum -y install libffi-devel

​二,安装numpy

pip install numpy

三,安装scipy

依次执行以下命令:​

yum install blas-devel

yum install lapack-devel

pip install scipy

四,安装Theano

依次执行以下命令:​

git clone git://github.com/Theano/Theano.git

cd Theano

python setup.py develop

五,安装Keras

依次执行以下命令:​

git clone https://github.com/fchollet/keras.git

cd keras

python setup.py install

六,验证keras按转成功​

验证python 终端执行import keras是否成功​