The easiest way to install Python and Jupyter Notebook is probably with Anaconda.

Anaconda is a free and open source distribution of the Python programming language for data science and machine learning related applications, that aims to simplify package management and deployment. Package versions are managed by the package management system conda.

First install bzip2 and wget if you do not have those yet

sudo yum install bzip2 wget

Download the last Anaconda installer for your environment:

cd ~/Downloads

Run it with sudo privileges

sudo sh

The installer will then begin and proceed with a series of questions.

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

Anaconda3 will now be installed into this location:

- Press ENTER to confirm the location
 - Press CTRL-C to abort the installation
 - Or specify a different location below

[/root/anaconda3] >>> /usr/local/miniconda3

I will NOT risk to prepend the Anaconda install location to PATH in your /root/.bashrc

All users have now access to Anaconda through:

  • conda - /usr/local/miniconda3/bin/conda
  • python - /usr/local/miniconda3/bin/python

You can install new packages with through the conda command line tool

sudo /usr/local/miniconda3/bin/conda install -c anaconda pip

And or with pip

sudo /usr/local/miniconda3/bin/pip install flask

Let’s update the Python packages

sudo /usr/local/miniconda3/bin/conda upgrade --all -y

Remove unused packages

sudo /usr/local/miniconda3/bin/conda clean --yes --all

A bunch of useful commands

List the previous versions of your conda environment

conda list --revisions

Rollback your environment to a specific previous version

conda install --revision 18

Install all required packages listed in a requirements.txt file

while read requirement; do conda install --yes $requirement; done < requirements.txt

Uninstall all unused packages in a conda virtual environment

conda clean --yes --all