Skip to content

Instantly share code, notes, and snippets.

@bhishanpdl
Last active July 31, 2019 19:20
Show Gist options
  • Save bhishanpdl/3942d96169b24495ccf968743f1d3687 to your computer and use it in GitHub Desktop.
Save bhishanpdl/3942d96169b24495ccf968743f1d3687 to your computer and use it in GitHub Desktop.
Install opencv3 (cv2)

Install opencv in MacOS Mojave (Oct 22, 2018)

conda create -n cv2 python=3.5
source activate cv2
conda install -n cv2 -c conda-forge numpy # cv2 needs numpy

#conda install anaconda-client # to search anaconda
#anaconda search -t conda opencv3
# I got https://conda.anaconda.org/menpo opencv3 for osx


sudo conda install -n cv2 --channel https://conda.anaconda.org/menpo opencv3

# Testing
vi cv2_example.py

Test following code

import cv2
print("OpenCV version:")
print(cv2.__version__)

Result

python cv2_example.py

# we get
OpenCV version:
3.1.0

Further

Install other packages

# Install additional packages
conda install -n cv2 -c conda-forge matplotlib
conda install -n cv2 -c conda-forge seaborn
conda install -n cv2 -c conda-forge pillow  # For PIL.Image, PIL.ImageTk, etc
conda install -n cv2 -c conda-forge  pandas
conda install -n cv2 -c conda-forge  scipy

Now install a new ipython kernel

sudo -H conda install -n cv2 -c conda-forge ipykernel
python -m ipykernel install --user --name cv2 --display-name "Python3.5 (cv2)"
sudo -H conda install -n cv2 -c conda-forge autopep8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment