Well this will be a lengthy answer, so let's start :

Step 1: Install prerequisites : Upgrade any pre-installed packages:

$ sudo apt-get update
$ sudo apt-get upgrade

Install developer tools used to compile OpenCV 3.0:

$ sudo apt-get install build-essential cmake git pkg-config

Install libraries and packages used to read various image and videos formats from disk:

$ sudo apt-get install libjpeg8-dev libtiff5-dev libpng-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev

Install GTK so we can use OpenCV’s GUI features:

$ sudo apt-get install libgtk2.0-dev

Install packages that are used to optimize various functions inside OpenCV, such as matrix operations:

$ sudo apt-get install libatlas-base-dev gfortran

Step 2: Setup Python (Part 1)

Let’s download pip , a Python package manager, installed for Python 3:

$ wget https://bootstrap.pypa.io/get-pip.py
$ sudo python3 get-pip.py

Let’s use our fresh pip3 install to setup virtualenv and virtualenvwrapper :

$ sudo pip3 install virtualenv virtualenvwrapper

Now we can update our ~/.bashrc file (place at the bottom of the file):

# virtualenv and virtualenvwrapper
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
$ source ~/.bashrc
$ mkvirtualenv cv

Step 2: Setup Python (Part 2)

we’ll need to install the Python 3.4+ headers and development files:

$ sudo apt-get install python3.4-dev

OpenCV represents images as NumPy arrays, so we need to install NumPy into our cv virtual environment:

$ pip install numpy

Step 3: Build and install OpenCV 3.0 with Python 3.4+ bindings

$ cd ~
$ git clone https://github.com/opencv/opencv.git
$ cd opencv
$ git checkout 3.0.0
$ cd ~
$ git clone https://github.com/opencv/opencv_contrib.git
$ cd opencv_contrib
$ git checkout 3.0.0

Time to setup the build:

$ cd ~/opencv
$ mkdir build
$ cd build
$ cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=/usr/local \
    -D INSTALL_C_EXAMPLES=ON \
    -D INSTALL_PYTHON_EXAMPLES=ON \
    -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \
    -D BUILD_EXAMPLES=ON ..

Let's start OpenCV compile process :

$ make -j4

Assuming OpenCV 3.0 compiled without error, you can now install it on your system:

$ sudo make install
$ sudo ldconfig

Step 4: Sym-link OpenCV 3.0

If you’ve reached this step, OpenCV 3.0 should now be installed in /usr/local/lib/python3.4/site-packages/.

Here, our OpenCV bindings are stored under the name cv2.cpython-34m.so

However, in order to use OpenCV 3.0 within our cv virtual environment, we first need to sym-link OpenCV into the site-packages directory of the cv environment, like this: (Be sure to take note of cv2.cpython-34m.so)

$ cd ~/.virtualenvs/cv/lib/python3.4/site-packages/
$ ln -s /usr/local/lib/python3.4/site-packages/cv2.cpython-34m.so cv2.so

Notice how I am changing the name from cv2.cpython-34m.so to cv2.so — this is so Python can import our OpenCV bindings using the name cv2 .

Step 5: Test out the OpenCV 3.0 and Python 3.4+ install

$ workon cv
$ python
>>> import cv2
>>> cv2.__version__
'3.0.0'

Hope that helps. Also, credit to Adrian Rosebrock on his post. It worked for me as a charm.

pip install opencv-python

https://pypi.org/project/opencv-python/

Option 3 - Headless main modules package: pip install opencv-python-headless ... export VERBOSE=1 python3 setup.py bdist_wheel --build-type=Debug.

Install OpenCV-Python in Ubuntu - OpenCV

https://docs.opencv.org/master/d2/de6/tutorial_py_setup_in_ubuntu.html

Install package python3-opencv with following command in terminal (as root user ). $ sudo apt-get install python3-opencv. Open Python IDLE (or IPython) and ...

python3 - How to install OpenCV 3.1 for Python 3.5 On Ubuntu 16.04 ...

https://askubuntu.com/questions/783956/how-to-install-opencv-3-1-for-python-3-5-on-ubuntu-16-04-lts

Update the repository: sudo apt-get update · Download the required packages to compile OpenCV: · Install the developer packages for Python3.

How to Install OpenCV on Ubuntu 18.04 | Linuxize

https://linuxize.com/post/how-to-install-opencv-on-ubuntu-18-04/

Jan 12, 2020 ... Refresh the packages index and install the OpenCV package by typing: sudo apt update sudo apt install python3-opencv. Copy Copy · To verify ...

Install OpenCV 3.0 and Python 3 on Ubuntu - PyImageSearch

https://www.pyimagesearch.com/2015/07/20/install-opencv-3-0-and-python-3-4-on-ubuntu/

Jul 20, 2015 ... I'll show you how to install OpenCV 3.0 with Python 3+ bindings on your Ubuntu 14.04 system. Click here to install OpenCV 3.0 and Python ...

Ubuntu, how to install OpenCV for python3? - Stack Overflow

https://stackoverflow.com/questions/37188623/ubuntu-how-to-install-opencv-for-python3

9 Answers · Step 1: Install prerequisites : · Step 2: Setup Python (Part 1) · Step 2: Setup Python (Part 2) · Step 3: Build and install OpenCV 3.0 with ...

pip install OpenCV - PyImageSearch

https://www.pyimagesearch.com/2018/09/19/pip-install-opencv/

Sep 19, 2018 ... Discover how to easily install OpenCV using pip on Ubuntu, macOS, and ... Let's create a Python 3 virtual environment for OpenCV called cv:.

Install opencv for Python 3.3 - Stack Overflow

https://stackoverflow.com/questions/20953273/install-opencv-for-python-3-3

EDIT: first try the new pip method: Windows: pip3 install opencv-python opencv- contrib-python. Ubuntu: sudo apt install python3-opencv.

OpenCV: Home

https://opencv.org/

OpenCV provides a real-time optimized Computer Vision library, tools, and hardware. It also supports model execution for Machine Learning (ML) and Artificial ...

Install OpenCV 4 with Python 3 on Windows | Solarian Programmer

https://solarianprogrammer.com/2016/09/17/install-opencv-3-with-python-3-on-windows/

Sep 17, 2016 ... How to install OpenCV 4 with Python 3 on Windows 10, we also show a small test of OpenCV Python usage.