Home  >  Article  >  Backend Development  >  Ubuntu14.04 installs Keras based on Anaconda and switches the backend to Theano

Ubuntu14.04 installs Keras based on Anaconda and switches the backend to Theano

PHP中文网
PHP中文网Original
2017-06-22 13:32:191855browse

0 System version Ubuntu16.04

1 System update (the speed is very slow, you can try skipping this step to see if it will affect subsequent installations)

sudo apt updatesudo apt upgrade

2 Install python basic development package

sudo apt install -y python-dev python-pip python-nose gcc g++ git gfortran vim

3 Download Anaconda and then install it in the terminal, follow the prompts to complete

chmod 777 Anaconda.shsudo ./Anaconda.sh

4 Install Anaconda You can then choose to automatically add environment variables. If the python input in the terminal is not the version of Anaconda, you can modify it accordingly: check the environment variables. If python is retrieved under /usr/bin, since this is a soft link, you can delete the original soft link and create a new one pointing to Anaconda. python under.

 -s ~/anaconda2/bin/python /usr/bin/python

5 In order to run conda in the terminal, if you have not added the environment variable, you can add the environment variable yourself: edit ~/.bashrc, add the environment variable (as shown below), and then source ~/.bashrc Or restart the terminal

export PATH=~/anaconda2/bin:$PATH

This also solves the problem in the previous step. The python version is the Anaconda version (more convenient than the solution in the previous step).

6 After changing, you can view the installed modules in the terminal

conda list

7 Download pycharm from the official website, decompress it and execute it. After running, search for the corresponding application in the dash and pull it to Taskbar as icon.

tar -xvf pycharm-community-2017.1.4.tar.gz
cd pycharm-community-2017.1.4/bin
./pycharm.sh

8 Install tensorflow and keras and test

sudo pip install tensorflowsudo pip install keras

python -c "import tensorflow"python -c "import keras"

9 Switch the backend to theonad: Find the configuration file: $HOME/ .keras/keras.json, change <span class="hljs-attribute">backend</span> field’s <span class="hljs-value"><span class="hljs-string">tensorflow</span></span> to theano

The above is the detailed content of Ubuntu14.04 installs Keras based on Anaconda and switches the backend to Theano. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn