Home > Backend Development > Python Tutorial > 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中文网
Release: 2017-06-22 13:32:19
Original
1884 people have browsed it

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
Copy after login

2 Install python basic development package

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

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

chmod 777 Anaconda.shsudo ./Anaconda.sh
Copy after login

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
Copy after login

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
Copy after login

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
Copy after login

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
Copy after login

8 Install tensorflow and keras and test

sudo pip install tensorflowsudo pip install keras

python -c "import tensorflow"python -c "import keras"
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template