The Wayback Machine - https://web.archive.org/web/20241008062946/https://www.geeksforgeeks.org/how-to-install-opencv-for-python-in-linux/
Open In App

How to Install OpenCV for Python in Linux?

Last Updated : 18 Jan, 2023
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

Prerequisite: Python Language Introduction   OpenCV is the huge open-source library for computer vision, machine learning, and image processing and now it plays a major role in real-time operation which is very important in today’s systems. By using it, one can process images and videos to identify objects, faces, or even the handwriting of a human. When it integrated with various libraries, such as Numpy, python is capable of processing the OpenCV array structure for analysis. To Identify image patterns and its various features we use vector space and perform mathematical operations on these features. To install OpenCV, one must have Python and PIP, preinstalled on their system. To check if your system already contains Python, go through the following instructions: Open the terminal using Ctrl+Alt+T Now run the following command: For Python2

python --version

For Python3.x

python3.x --version

If Python is already installed, it will generate a message with the Python version available. Check-python-version-for-linux If Python is not present, go through How to install Python on Linux? and follow the instructions provided.   PIP is a package management system used to install and manage software packages/libraries written in Python. These files are stored in a large “on-line repository” termed as Python Package Index (PyPI). To check if PIP is already installed on your system, just go to the terminal and execute the following command:

pip3 --version

pip-Version-check-linux If PIP is not present, go through How to install PIP on Linux? and follow the instructions provided.

Downloading and Installing OpenCV:

OpenCV can be directly downloaded and installed with the use of pip (package manager). To install OpenCV, just go to the terminal and type the following command:

pip3 install opencv-python

Beginning with the installation:

  • Type the command in the Terminal and proceed: OpenCV-Installation-Linux-01
  • Collecting Information and downloading data: OpenCV-Installation-Linux-02
  • Installing Packages: OpenCV-Installation-Linux-03
  • Finished Installation: OpenCV-Installation-Linux-04

To check if OpenCV is correctly installed, just run the following commands to perform a version check:

python3
>>>import cv2
>>>print(cv2.__version__)

OpenCV-Verification-Linux


Previous Article
Next Article

Similar Reads

How to Install opencv in C++ on Linux?
OpenCV stands for open-source Computer Vision Library. It is a library that provides infrastructure for computer vision and machine learning applications. It has more than 2500 Computer vision and machine learning algorithms. They can be used to track objects, recognize faces and objects, stitch images, etc. It can be used with c, c++ python, and j
3 min read
OpenCV - Facial Landmarks and Face Detection using dlib and OpenCV
Content has been removed on Author's request.
1 min read
Transition from OpenCV 2 to OpenCV 3.x
OpenCV is one of the most popular and most used Computer vision libraries. It contains tools to carry out image and video processing. When OpenCV 3..4.1 is an improved version of OpenCV 2.4 as it introduced new algorithms and features. Although some of the existing modules were rewritten and moved to sub-modules. In this articles, I will focus on t
2 min read
Top Books for Learning OpenCV: Computer Vision with OpenCV Library
OpenCV or Open Source Computer Vision Library, is an open-source computer vision and machine learning software library. It's extensively used for real-time computer vision tasks such as object detection, face recognition, image processing, etc. Whether you're a beginner or an experienced developer looking to deepen your understanding of OpenCV, her
5 min read
Automatic Document Scanner using OpenCV (OpenCV Document Scanner)
An automatic document scanner using OpenCV is a computer vision application that automatically detects and extracts documents from images. This type of scanner can be useful in various scenarios, such as digitizing paper documents, processing scanned documents, or automating document recognition tasks. In this article, we will see how we can build
6 min read
How to install OpenCV Contrib Python
OpenCV (Open Source Computer Vision Library) is a powerful open-source computer vision and machine learning software library. It provides various tools and algorithms for image and video processing, object detection, feature extraction, and more. OpenCV Contrib is an extension module that includes additional functionalities and algorithms contribut
2 min read
How to Install OpenCV Python Headless?
OpenCV (Open Source Computer Vision Library) is a powerful open-source computer vision and machine learning software library. It enables developers to access a wide range of algorithms for various computer vision tasks. In this article, we will see how to install OpenCV Python Headless. What is OpenCV Python Headless?Installing OpenCV in Python hea
2 min read
How to install OpenCV for Visual Studio Code and Python?
OpenCV is a powerful computer vision library widely used for image and video processing tasks. Integrating OpenCV with Visual Studio Code (VS Code) allows developers to leverage their capabilities within a familiar development environment. In this article, we will see how we can install OpenCV for Visual Studio code and Python. Steps to Install Ope
1 min read
How to Install OpenCV for Python on Windows?
Prerequisite: Python Language Introduction   OpenCV is the huge open-source library for computer vision, machine learning, and image processing and now it plays a major role in real-time operation which is very important in today’s systems. By using it, one can process images and videos to identify objects, faces, or even the handwriting of a human
4 min read
How to Install Opencv 4 on MacOS?
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: Insta
2 min read
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 gives it an edge over all other similar libraries.
4 min read
How to Install OpenCV in Ubuntu?
OpenCV is a powerful and versatile library widely used for real-time computer vision tasks. It's commonly used in applications like image and video processing, object detection, facial recognition, and more. Recent versions of Ubuntu come with pre-built OpenCV packages available through the apt package manager. Table of Content 1. Install OpenCV in
4 min read
How to install OpenCV latest Version?
OpenCV, an open-source computer vision and machine learning software library, is widely used for various image and video processing tasks. Keeping it up-to-date ensures access to the latest features and enhancements. In this article, we will see how we can upgrade the latest Opencv Version in Python. Install the Latest Opencv Version Below are some
1 min read
Install OpenCV on Jupyter Notebook
With Jupyter Notebook, users can create and share documents with live code, equations, visualizations, and narrative text in an interactive computing environment. An open-source software library for computer vision and machine learning is called OpenCV (Open Source Computer Vision Library). When combined, they allow users to interact and conduct in
4 min read
Install OpenCV that was built with CMAKE build option to venv
OpenCV (Open Source Computer Vision Library) is a powerful tool for image processing and computer vision tasks. Often, we may need to customize the OpenCV installation using CMake to include specific modules or optimizations. This guide will walk us through the process of building OpenCV from the source using CMake and installing it into the Python
2 min read
How to Download and Install Python Latest Version on Linux?
Python is a widely-used general-purpose, high-level programming language. This article will serve as a complete tutorial on How to download and install Python latest version on Linux Operating Systems. On every Linux system including following OS, Ubuntu Linux Mint Debian openSUSE CentOS Fedora and my favourite one, Arch Linux. You will find Python
3 min read
How to Install Python Pycharm on Linux?
Prerequisite: Python Language Introduction Python is a widely-used general-purpose, high-level programming language. It was initially designed by Guido van Rossum in 1991 and developed by Python Software Foundation. It was mainly developed for emphasis on code readability, and its syntax allows programmers to express concepts in fewer lines of code
2 min read
How to Install Python-USPP on Linux?
Python-USPP is a multi-platform Python library that allows communication between Python programs and USPP devices. This library is written in Python itself. It supports Windows, Linux, and MacOS. In this article, we will learn how to install this library in the Linux operating system. Python USPP installation on Linux The python uspp has been devel
3 min read
How to Install Jmespath in Python in Linux?
Jmespath is known as the JSON query language for Python. It is used to find or extract the needed data from the JSON document or dictionary very quickly. It is also available in other languages also. In this article, we will be looking at the stepwise procedure to install the Jmespath for Python in Linux Operating System. Requirements: Python3Pytho
2 min read
How to Install Numdifftools in Python on Linux?
Numdifftools is a Python-based toolkit that solves numerical differentiation issues in one or more variables automatically. To produce the most accurate outcome, finite differences are exploited adaptively in conjunction with a Richardson extrapolation mechanism. This library is cross-platformed, so it can work with Windows, Linux, and even with ma
2 min read
Python - Install Paramiko on Windows and Linux
The high-level python API starts with the creation of a secure connection object. To have more direct control and pass a socket to transport to start remote access. As a client, it's authenticating using a user credential or private key, and checking the server’s host key. Paramiko is a Python library that makes a connection with a remote device th
1 min read
How to Install python-nmap Library on Linux?
Python-Nmap is a network mapper that is exceptionally vital in handling security auditing and discovering the network. It exists as an open-source project; thus it is available for free. All the core operating systems support Python-Nmap. However, the binary packages are only available for Windows, Linux, and Mac OS X. Nmap is essential in port sca
5 min read
How to Install xlrd in Python on Linux?
In this article, we will learn how to install xlrd in Python on Linux. The xlrd is a library for reading data and formatting information from Excel files in the historical .xls format. Installing xlrd in Python on Linux:Method 1: Using pip to install xlrd Package Follow the below steps to install the xlrd package on Linux using pip: Step 1: Install
2 min read
How to Install Python-pickle package on Linux?
Python pickle package is used for serializing and de-serializing a Python object structure. Any object in Python can be pickled so that it can be stored on the local disk. What pickle does is that it “serializes” the object first before writing it to a file. Pickling is a way to transform a python object (list, dict, etc.). So, in this article, we
2 min read
How to Install Python docutils on Linux?
Docutils is an open-source text processing system. It is written in Python language. It is used to process simple text or plaintext documents into some useful formats like LaTex, HTML, OpenDocument, XML, etc. It is easy to use and easy to read. It is available for operating systems like, Windows, macOS, Linux, etc., and is supported by Python2 and
2 min read
How to Install Packages in Python on Linux?
To install a package in python, we use pip. The pip is a python package manager. In this tutorial, we will be discussing how we can install packages in python on a Linux system. To install packages in python on Linux, we must have python and pip installed on our Linux machine. As python comes preinstalled with the Linux system, we may have to insta
2 min read
How to Install Astropy Python Library on Linux?
Astropy is an open-source library written purely in Python, specifically designed for use in astronomy and astrophysics. Anyone can develop astronomy software with Astropy Astronomy Tools. Astropy library is a cross-platform library for various operating systems such as Windows, Linux, and macOS. In this article, we will see an easy way to install
2 min read
How to Install SQLAlchemy in Python on Linux?
SQLAlchemy is the Python SQL toolkit and Object Relational Mapper that is used as flexible database access using SQL. In this article, we will look into the process of installing SQLAlchemy on a windows machine. Pre-requisites: The only thing that you need for installing Numpy on Windows are: PythonPIP or Conda (Depending upon the user preference)I
2 min read
How to Install cx_oracle in Python on Linux?
The cx_oracle package is used to connect with the Oracle database using python. In this, article, we will look into the process of installing the cx_oracle package on Linux. Pre-requisites: The only thing that you need for installing Numpy on Windows are: PythonPIP or Conda (Depending upon the user preference)Installing cx_oracle Package on Linux u
2 min read
How to Install Scipy In Python on Linux?
In this article, we are going to see how to install Scipy in Python on Linux, SciPy is a python library that is useful in solving many mathematical equations and algorithms, it is a free and open-source Python library built on top of the popular NumPy library. To install Scipy on Linux: There are generally two easy methods using which we can instal
2 min read