Steps to install OpenCV-Python on Mac
In this tutorial, you will learn how to install opencv-python library on you Mac using pip command in terminal.
Please follow the below steps to install OpenCV-Python library on you Mac.
1. Open Terminal.
Search from Terminal program. And Click on the Terminal.
![](https://pythonexamples.org/wp-content/uploads/2023/04/python-opencv-install-on-mac-1.png)
A terminal window opens as shown in the following screenshot.
![](https://pythonexamples.org/wp-content/uploads/2023/04/python-opencv-install-on-mac-2-1.png)
2. Run pip command.
Run the following pip command.
sudo pip install opencv-python
Enter the password if prompted.
![](https://pythonexamples.org/wp-content/uploads/2023/04/python-opencv-install-on-mac-3.png)
The opencv-python library is successfully installed.
3. Check the installation.
You may run a simple program to import cv2 library, and read an image.
In the following program, we read an image and display the image dimensions.
Python Program
import cv2
# Read image
img = cv2.imread('test_image.jpg')
# Print image dimensions
print('Image Dimensions :', img.shape)
Output
Image Dimensions : (452, 640, 3)
Summary
In this Python OpenCV Tutorial, you learned how to install OpenCV-Python library.