Install Anaconda on Linux-Centos7

Install Anaconda on Linux-Centos7

Reload: Install Anaconda (new version 2019) under Linux-Centos7

Anaconda3+Tensorflow/Keras has been installed many times under the linux system, and the installation of Anaconda is really simple, but there are still some jams installed on the new server today, so I decided to tidy up for my future reference.

Environment: Centos 7

Part1. Download Anaconda

Directly in Official Web Download is slow, we recommend using Tsinghua Mirror (you can also change the source of pip to domestic, pip install will be much faster): Tsinghua Open Source Mirror

On the latest date, select an Anaconda3 installation package corresponding to your system version, x86_64 means compatible with 32-bit and 64-bit systems. Right-click the copy link and use wget to download in linux.

wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2019.03-Linux-x86_64.sh

If prompted that there is no wget, install using yum:

yum -y install wget

Part2. Install Anaconda

Execute the file in the download directory with a different name depending on the version you download:

bash Anaconda3-2019.03-Linux-x86_64.sh

Next comes a bunch of icense License statements, all the way back down, with the following text, type yes:

Do you accept the license terms? [yes|no]
[no] >>> 
Please answer 'yes' or 'no':
>>> yes

Then choose the installation directory and enter the absolute path if you need to change the Enter without changing it:

(You can view the hard disk mount first, then choose the installation directory by yourself. The statement to view the mount is df-h)

Anaconda3 will now be installed into this location:
/root/anaconda3
  • Press ENTER to confirm the location
  • Press CTRL-C to abort the installation
  • Or specify a different location below

[/root/anaconda3] >>>

There may be an error indicating that bunzip2 could not be found:

Anaconda3-2019.03-Linux-x86_64.sh: line 353: bunzip2: command not found
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors

Also install using yum, named bzip2:

yum install -y bzip2

After resolving bzip2, repeat the previous steps to install anaconda3, wait a few moments before you have the option to ask if you need to initialize conda and suggest typing no. If yes is selected, it is at / root/. Automatically adding environment variables to the bashrc directory will cause the base environment to start automatically on startup. (This should be a change to the new version of the installation package. Older versions of the installation package all ask if conda needs to be added to environment variables, and the default direct return Enter is not added, if it is not added later it needs to be added manually.)

Do you wish the installer to initialize Anaconda3
by running conda init? [yes|no]
[no] >>> no

Installation succeeded when prompted as follows:

Thank you for installing Anaconda3!

===========================================================================

Anaconda and JetBrains are working together to bring you Anaconda-powered
environments tightly integrated in the PyCharm IDE.

PyCharm for Anaconda is available at:
https://www.anaconda.com/pycharm

If yes was chosen for conda's initialization, then the environment variable is already configured, enter a simple command to test it:

conda activate # Entering conda environment and appearing (base) indicates successful installation
conda deactivate # Exit conda environment

It is important to note that the new version disables the source activate command, and that if you use an older installation package, you use the following command:

source activate # Entering conda environment and appearing (base) indicates successful installation
source deactivate # Exit conda environment

If conda is initialized with no, you need to configure the environment variable yourself.

Open the profile file:

vi /etc/profile

Add the following statement to the end of the file (the path needs to be changed according to your installation location):

PATH=
       
        
         
          
           P
          
          
           A
          
          
           T
          
          
           H
          
          
           <
          
          
           /
          
          
           s
          
          
           p
          
          
           a
          
          
           n
          
          
           >
          
          
           :
          
          
           /
          
          
           o
          
          
           p
          
          
           t
          
          
           /
          
          
           a
          
          
           n
          
          
           a
          
          
           c
          
          
           o
          
          
           n
          
          
           d
          
          
           a
          
          
           3
          
          
           /
          
          
           b
          
          
           i
          
          
           n
          
          
           <
          
          
           s
          
          
           p
          
          
           a
          
          
           n
          
          
           c
          
          
           l
          
          
           a
          
          
           s
          
          
           s
          
          
           =
          
          
           "
          
          
           n
          
          
           b
          
          
           "
          
          
           >
          
          
           e
          
          
           x
          
          
           p
          
          
           o
          
          
           r
          
          
           t
          
          
           <
          
          
           /
          
          
           s
          
          
           p
          
          
           a
          
          
           n
          
          
           >
          
          
           P
          
          
           A
          
          
           T
          
          
           H
          
          
           <
          
          
           /
          
          
           c
          
          
           o
          
          
           d
          
          
           e
          
          
           >
          
          
           <
          
          
           /
          
          
           p
          
          
           r
          
          
           e
          
          
           >
          
          
           <
          
          
           /
          
          
           d
          
          
           i
          
          
           v
          
          
           >
          
          
           <
          
          
           p
          
          
           >
          
          
           Press
          
          
           live
          
          
           s
          
          
           h
          
          
           i
          
          
           f
          
          
           t
          
          
           key
          
          
           +
          
          
           :
          
          
           key
          
          
           ,
          
          
           transport
          
          
           enter
          
          
           w
          
          
           q
          
          
           ,
          
          
           Protect
          
          
           Existing
          
          
           writing
          
          
           piece
          
          
           and
          
          
           retreat
          
          
           Out
          
          
           . 
          
          
           most
          
          
           after
          
          
           send
          
          
           use
          
          
           as
          
          
           lower
          
          
           life
          
          
           order
          
          
           brush
          
          
           new
          
          
           ring
          
          
           Territory
          
          
           change
          
          
           amount
          
          
           That is
          
          
           can
          
          
           : 
          
          
           <
          
          
           /
          
          
           p
          
          
           >
          
          
           <
          
          
           d
          
          
           i
          
          
           v
          
          
           c
          
          
           l
          
          
           a
          
          
           s
          
          
           s
          
          
           =
          
          
           "
          
          
           h
          
          
           i
          
          
           g
          
          
           h
          
          
           l
          
          
           i
          
          
           g
          
          
           h
          
          
           t
          
          
           "
          
          
           >
          
          
           <
          
          
           p
          
          
           r
          
          
           e
          
          
           >
          
          
           <
          
          
           c
          
          
           o
          
          
           d
          
          
           e
          
          
           c
          
          
           l
          
          
           a
          
          
           s
          
          
           s
          
          
           =
          
          
           "
          
          
           l
          
          
           a
          
          
           n
          
          
           g
          
          
           u
          
          
           a
          
          
           g
          
          
           e
          
          
           −
          
          
           b
          
          
           a
          
          
           s
          
          
           h
          
          
           "
          
          
           >
          
          
           <
          
          
           s
          
          
           p
          
          
           a
          
          
           n
          
          
           c
          
          
           l
          
          
           a
          
          
           s
          
          
           s
          
          
           =
          
          
           "
          
          
           n
          
          
           b
          
          
           "
          
          
           >
          
          
           s
          
          
           o
          
          
           u
          
          
           r
          
          
           c
          
          
           e
          
          
           <
          
          
           /
          
          
           s
          
          
           p
          
          
           a
          
          
           n
          
          
           >
          
          
           /
          
          
           e
          
          
           t
          
          
           c
          
          
           /
          
          
           p
          
          
           r
          
          
           o
          
          
           f
          
          
           i
          
          
           l
          
          
           e
          
          
           <
          
          
           s
          
          
           p
          
          
           a
          
          
           n
          
          
           c
          
          
           l
          
          
           a
          
          
           s
          
          
           s
          
          
           =
          
          
           "
          
          
           n
          
          
           b
          
          
           "
          
          
           >
          
          
           e
          
          
           c
          
          
           h
          
          
           o
          
          
           <
          
          
           /
          
          
           s
          
          
           p
          
          
           a
          
          
           n
          
          
           >
          
          
           <
          
          
           s
          
          
           p
          
          
           a
          
          
           n
          
          
           c
          
          
           l
          
          
           a
          
          
           s
          
          
           s
          
          
           =
          
          
           "
          
          
           n
          
          
           v
          
          
           "
          
          
           >
          
         
         
          PATH</span>:/opt/anaconda3/bin <span class="nb">export</span> PATH</code></pre></div><p>Press and hold shift key+:Key, enter wq,Save the file and exit. Finally, use the following command to refresh the environment variables:</p><div class="highlight"><pre><code class="language-bash"><span class="nb">source</span> /etc/profile <span class="nb">echo</span> <span class="nv">
         
        
       PATH</span>:/opt/anaconda3/bin<spanclass="nb">export</span>PATH</code></pre></div><p>Press and hold shift key+:Key, enterwq,Save the file and exit. Finally, use the following command to refresh the environment variables:</p><divclass="highlight"><pre><codeclass="languagebash"><spanclass="nb">source</span>/etc/profile<spanclass="nb">echo</span><spanclass="nv">PATH

Enter and exit environments also use commands that start with source:

source activate # Entering conda environment and appearing (base) indicates successful installation
source deactivate # Exit conda environment

Tags: Python

Posted by FastLaneHosting on Mon, 18 Apr 2022 01:51:16 +0930