Install OpenCV 4 on macOS Mojave with Python 3.7 – matplotlib not supported

Firstly, make sure you have python 3.7 installed on your system.

Install Miniconda

Go to this Miniconda download page and download Miniconda installation bash file(.sh) for Mac OS X.

Assuming that your default download directory is Downloads, open terminal then use the following command:

$ bash

Enter and choose yes all the way.

After the installation, now close the terminal window to make all the changes take effect.

Check Python Version

Making sure you’re using python 3.7

$ python --version
$ which python

Create a new environment for OpenCV

$ conda create -n myenv python=3.7

Enter the environment

You should always use the following command to enter the environment.

$ source activate myenv

Install the OpenCV Package

This is only required for the first time.

$ pip install opencv-python

Try out OpenCV

Enter the python interactive terminal at first.

$ python

In the python terminal, try to import cv2

>>> import cv2

If no error occurs, congratulations, we are all done!

More to know

You should be able to use the environment with the command

$ source activate myenv

And you can always create a python source file with idle3:

$ idle3

Issues remaining

matplotlib not working correctly


A youtube video