Ubuntu16+Anaconda3+tensorflow (cpu), build a deep learning environment

Summary:

  1. introduction
  2. Anaconda3 installation
  3. tensorflow (cpu) installation
  4. spyder installation
    1. Introduction
    Recently, we need to study semantic segmentation based on deep learning, and understand that semantic segmentation has two-dimensional and three-dimensional fields. Let's first understand the two-dimensional semantic segmentation, and selected deeplab and mobileNet. So first build a simple deep learning environment, which is a novice entry.
    WINDOWS10+ubuntu16.04 dual-system
    NVIDIA 940m graphics card, 2GB independent video memory.
    Use the following command to check the computer graphics card. Notebooks cannot use desktops, so the following are the cpu version configurations
ubuntu-drivers devices

2. Anaconda installation
This is used to manage the python library. Look at the Internet and say that this is a non-essential installation, but it will be troublesome if it is not installed.
ubuntu comes with python version 2.7.12, I have installed python3.5.2. I have searched for a long time before I found the anaconda corresponding to python3.5, so I installed anaconda3-5.0.1 (corresponding to python3.6) and the code is as follows:

wget https://repo.continuum.io/archive/Anaconda3-5.0.1-Linux-x86_64.sh
bash Anaconda3-5.0.1-Linux-x86_64.sh #安装Anaconda

source ~/.bashrc  #刷新,立即生效

After installing this, I found the version corresponding to python3.5. I was too lazy to uninstall and reinstall. Put on the installation method:
python3.5 corresponds to anaconda3 installation
(1) download, download from the official website is slow, recommend Tsinghua's mirror website to download anaconda to download
python3 .5 It is recommended to download two versions of Anaconda3 4.1.1 or 4.2.0,
such as anaconda3-4.2.0-linux-x86_64.sh.
(2) Install, open the terminal and enter:

bash Anaconda3-4.1.1-Linux-x86_64.sh

Enter yes when you want to enter yes/no in the middle, press Enter, and select the default installation address home/username/anaconda3
(3) Configure the environment, enter the terminal sudo gedit ~/.bashrc, and add at the end

export PATH="/home/username/anaconda3/bin:$PATH"
//Username is modified according to the specific situation

Then update,

source ~/.bashrc

Enter conda -v after the update, if there is no error, it will show success.
3. tensorflow (cpu) installation
There are multiple installation methods on the Internet, source installation, pip installation, I choose anaconda installation.
(1) Change the download source to make the download or update faster

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
 conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --set show_channel_urls yes

(2) Install the CPU version of tensorflow

conda install -c https://conda.anaconda.org/jjhelmus tensorflow

After the installation is complete, the test is successful, import it in python, and it will be successful if no error is reported

(tensorflow) hy@hy-win:~$ python
import tensorflow as tf

Insert picture description here(3) Exit the conda environment after installation

(tensorflow) hy@hy-win:~$ source deactivate

4. spyder installation

hy@hy-win:~$ source activate tensorflow
(tensorflow) hy@hy-win:~$ conda install spyder

After the installation is complete, enter spyder in the terminal to display the interface, and it depends on python3.5

------------------------------Dividing line------------------ -------------------------------------------------- ---------
What you want to install later is very simple, as long as in the tensorflow environment,
conda install ***For
example , the python3.5 I use does not have matplotlib library by default, then just install
conda install matplotlib
ok ! Imported successfully

Guess you like

Origin blog.csdn.net/qq_43265072/article/details/105051866