Installing opencv for python in spyder(using conda/anaconda) on ubuntu

First we need to download anaconda in come directory

cd 
curl -O https://repo.continuum.io/archive/Anaconda3-5.0.1-Linux-x86_64.sh

then to check to download is completed properly you can type

sha256sum Anaconda3-5.0.1-Linux-x86_64.sh

now to run the script you can type

bash Anaconda3-5.0.1-Linux-x86_64.sh

In the process of instillation i may ask to accept the license you can press ENTER to read the doc and move to the bottom line, at the end press yes to  accept the terms.

 

once the process is completed. it will ask permission to add the anaconda directory to .bashrc press yes

 

then to activate the installation type

source ~/.bashrc

to verify the instillation  you can type below command

conda --version

If it fails you can add the path of anaconda by using below command and check the version using above command

export PATH=~/anaconda3/bin:$PATH

 

Now to install opencv type the below commands

conda install -c conda-forge opencv  conda install -c conda-forge/label/gcc7 opencv  condainstall -c conda-forge/label/broken opencv 

 

Then type spyder on terminal it should open spyder IDE

Then to check opencv instillation you can run import command in the script

import cv2