Anaconda installation on CentOS

Overview

Anaconda package is very useful tool for data analysis by python language. This article shows how to install it on CentOS.

Environments

OS:CentOS7
Anaconda3:3-5.3.1

What is Anaconda

Nowadays the usage of python language is being more popular than before for the purpose of machine learning or processing data. Anaconda package is consists of not only python engine but also IDE, web-base editor or some useful tools. When you just install anaconda, you can use these bundled useful tools.

CentOS7 has python 2 as a default but in this example we use Anaconda with python3.

Step1 : pyenvのインストール

At first let’s install pyenv which is manage some of python version easily. If you install pyenv, you can switch python2 or python3 at any time.

Here is the command to install pyenv.

#Install pyenv by git command	
$ git clone git://github.com/yyuu/pyenv.git ~/.pyenv	

#Add the path in .bash_profile	
$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile	

#Definition of path of $PYENV_ROOT
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile	

#Initializing pyenv
$ echo 'eval "$(pyenv init -)"' >> ~/.bash_profile	

#Reload bashrc
$ source ~/.bashrc

Step2 : Installation of Anaconda3

You can check which version of anaconda is available now with following commands.

#Check available anaconda ver.
$ pyenv install --list | grep anaconda
    anaconda-1.4.0
    ...
    anaconda3-5.3.1

After deciding which version you want to use, you can get anaconda with ‘pyenv install’ .

#Installation of anaconda
$ pyenv install anaconda3-5.3.1
    Downloading Anaconda3-5.3.1-Linux-x86_64.sh.sh...
    -> https://repo.continuum.io/archive/Anaconda3-5.3.1-Linux-x86_64.sh
    Installing Anaconda3-5.3.1-Linux-x86_64.sh...
    Installed Anaconda3-5.3.1-Linux-x86_64.sh to /.pyenv/versions/anaconda3-5.3.1

#Reconstruction of hash table
$ pyenv rehash

#definition of anaconda environment
$ pyenv global anaconda3-5.3.1

#adding path
echo 'export PATH="$PYENV_ROOT/versions/anaconda3-5.3.1/bin/:$PATH"' >> ~/.bashrc

#execution
$ source ~/.bashrc

#updating of conda
conda update conda

#confirmation of python
$ pyenv -V
 Python 3.7.0 (default, Jun 28 2018, 13:15:42)

You can find python3 environment was constructed in your CentOS. Please try it.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *