Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • Open CV
  • scikit-image
  • pycairo
  • Pyglet
  • Python
  • Numpy
  • Pandas
  • Python Database
  • Data Analysis
  • ML Math
  • Machine Learning
  • NLP
  • Deep Learning
  • Deep Learning Interview Questions
  • ML Projects
  • ML Interview Questions
  • 100 Days of Machine Learning
Open In App
Next Article:
How to Install C# on MacOS?
Next article icon

How to Install Opencv 4 on MacOS?

Last Updated : 22 Sep, 2021
Comments
Improve
Suggest changes
Like Article
Like
Report

In this article, we will learn how to install Opencv 4  in Python on MacOS. OpenCV (Open Source Computer Vision Library) is a library of programming functions mainly aimed at real-time computer vision.

Installation:

Method 1: Using pip to install Opencv 4 Package

Follow the below steps to install the Opencv 4 package on macOS using pip:

Step 1: Install the latest Python3 in MacOS

Step 2: Check if pip3 and python3 are correctly installed.

python3 --version  pip3 --version
checking python and pip version in macos

Step 3: Upgrade your pip to avoid errors during installation.

pip3 install --upgrade pip
upgrading pip in macos

Step 4: Enter the following command to install Opencv 4 using pip3.

pip3 install opencv-python
installing Opencv 4 package on macOS using pip

Method 2: Using setup.py to install Opencv 4

Follow the below steps to install the Opencv 4 package on macOS using the setup.py file:

Step 1: Download the latest source package of Opencv 4 for python3 from here.

curl https://files.pythonhosted.org/packages/01/9b/be08992293fb21faf35ab98e06924d7407fcfca89d89c5de65442631556a/opencv-python-4.5.3.56.tar.gz > opencv.tar.gz
downloading the source package for Opencv 4 in macos

Step 2: Extract the downloaded package using the following command.

tar -xzvf opencv.tar.gz
extracting the opencv.tar.gz file in macos

Step 3: Go inside the folder and Enter the following command to install the package.

Note: You must have developer tools for XCode MacOS installed in your system

cd opencv-python-4.5.3.56  python3 setup.py install
installing Opencv 4 on macOS using the setup.py file

Verifying Opencv 4 installation on macOS:

Make the following import in your python terminal to verify if the installation has been done properly:

import cv2
Verifying Opencv 4 installation on macOS

If there is any error while importing the module then is not installed properly.


Next Article
How to Install C# on MacOS?
author
anilabhadatta
Improve
Article Tags :
  • Python
  • Blogathon
  • Blogathon-2021
  • Python-OpenCV
  • how-to-install
Practice Tags :
  • python

Similar Reads

  • How to Install OpenCV for C++ on MacOS?
    OpenCV stands for Open Source Computer and Vision Library. It is a huge open-source library with more than 2500 algorithms that are optimized to perform various operations like computer vision, image processing, and machine learning in real-time. It performs all these operations in real-time which g
    4 min read
  • How to Install PIL on MacOS?
    PIL is an acronym for the python image library. It is a library that is used to manipulate images, using PIL library with python we can perform various operations on images. In this article, we are going to learn how we can install PIL on MacOS. Method 1: Using PIP to install PIL (Pillow). Python co
    1 min read
  • How to Install Theano on MacOS?
    Theano is a Python library that allows us to evaluate mathematical operations including multi-dimensional arrays so efficiently. It is mostly used in building Deep Learning Projects. It works way faster on Graphics Processing Unit (GPU) rather than on the CPU. In this article, we will look into the
    1 min read
  • How to Install C# on MacOS?
    C# is a programming language that is used for general purposes. But the C# programming language is classified as one of the High-Level programming languages. Unlike the C programming language, the C# programming language can be used in other tasks. There might be a significant similarity between the
    4 min read
  • How to Install Pytorch on MacOS?
    PyTorch is an open-source machine learning library based on the Torch library, used for applications such as computer vision and natural language processing, primarily developed by Facebook's AI Research lab. It is free and open-source software released under the Modified BSD license. Prerequisites:
    2 min read
  • How to Install PyBrain on MacOS?
    PyBrain is an open-source and free-to-use Python-based Machine Learning Library. Its main purpose is to provide machine learning tasks with flexible, easy-to-use, still a very powerful algorithms. It also provides a wide range of predefined environments which is used to test and compare different ty
    2 min read
  • How to Install Turbo C++ on MacOS?
    Turbo C++ is a single-language compiler and integrated development environment. It is free of charge and can be downloaded from any website. The first release of Turbo C++ was released in May 1990 version 1.0, running on MS-DOS computers. For the C++ programming language, Turbo C++ is an integrated
    4 min read
  • How to Install Seaborn on MacOS?
    In this article, we will learn how to install seaborn in Python on MacOS. Seaborn is a library for making statistical graphics in Python. It is built on top of matplotlib and is closely integrated with pandas data structures. Installation:Method 1: Using pip to install Seaborn Package Follow the bel
    2 min read
  • How to Install NuPIC on MacOS?
    NuPIC stands for Numenta Platform for Intelligent Computing is a platform that implements the HTM (Hypertext Markup Language) learning algorithm. HTM is a detailed computational theory of the neocortex. At the core of HTM are timeframe continuous learning algorithms.NuPIC is used for a variety of pr
    1 min read
  • How to Install Scala on MacOS?
    In this article, we are going to show you how you can download and install Scala on your Mac operating system. First of all, you need to download the Java JDK which you can download here Installing Scala on MacOS: Follow the below steps to install Scala on MacOS: Step 1: After installing JDK, run th
    2 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences