Reference: Keras Chinese Handbook
Note: This installation has only a CPU-accelerated process and no GPU acceleration. 1. First install Linux recommended Ubuntu, version can choose 16.04. 2. Ubuntu Initial environment Settings (1) First system upgrade
>>>sudo APT Update
>>>sudo apt Upgrade (2) to install a Python-based development package
>>>sudo apt install-y python-dev python-pip python-nose gcc g++ git gfortran vim 3. Install Operation Acceleration Library
>>>sudo apt install-y libopenblas-dev liblapack-dev libatlas-base-dev 4.keras Frame construction
>>>sudo pip install-u--pre pip setuptools Wheel
>>>sudo pip install-u--pre numpy scipy matplotlib scikit-learn scikit-image
>>>sudo pip Install-u--pre Theano
>>>sudo pip install-u--pre keras 5. After the installation is successful, start the test
>>>python//Enter the Python environment
>>>import Theano
>>>import Keras
It should be explained here that, since Keras default backend is TensorFlow, an error occurs when you execute import keras, as shown in the following figure.
So we need to rewrite Keras.json This configuration document, modify the Keras default backend to Theano. This document is in: ~/.keras/keras.json, some people who are unfamiliar with Linux will not understand the meaning of this path, ~ represents your/home/user name directory,. Keras's front '. ' Represents a hidden file. Therefore, this file does not exist in the Keras installation directory, this should be clear. I was just running straight to
Keras installation directory to build Keras.json, silly to get a day.
Here we can use the
>>>gedit ~/.keras/keras.json to open the configuration file. It is important to note that when you enter the execution command, you exit the Python environment with exit (), which should be entered in the Linux environment, as shown in the following figure.
It is very important to note that the file is strange, directly in the change ' backend ' as ' Theano ' does not seem to work, so it is best to also in another file to rewrite the configuration file, and then copy into the original file. So when you have directly modified to complete, still reported backend is TensorFlow, please
Be sure to remember this sentence. The following is the contents of the Keras.json file.
At this point the Keras platform is ready to build.