PDF download Download Article PDF download Download Article

OpenCV is a tool used for image processing and computer vision. [1] Python is the most popular programming language that is supported by OpenCV because it is simple to use. Anaconda contains a variety of Python packages that are used in data science and machine learning. There are a variety of ways to install OpenCV in Anaconda for Windows, Mac, and Linux. This wikiHow article teaches you how to install OpenCV in Anaconda.

Method 1
Method 1 of 4:

Using the Anaconda Navigator

PDF download Download Article
  1. Python is the programming language Anaconda was written for. If you have not already done so, be sure to install Python . You can download the latest Python installer for Windows, Mac, or Linux at https://www.python.org/downloads/ . Download the Python install and open the installation file. Then follow the instructions to complete the installation.
  2. The Individual Edition of Anaconda is open-source and free to download for all platforms. If you want the Commercial or Enterprise edition, you will need to purchase a license. Use the following steps to download and install the Individual Edition of Anaconda:
    • Visit https://www.anaconda.com/products/individual using a web browser.
    • Click the icon for the operating system you are using below "Get additional Installers".
    • Click the download link that is appropriate for your operating system.
    • Open the installation file in your Downloads folder or web browser.
    • Follow the instructions to complete the installation.
    • Select " Only Me " when asked if you want to install Anaconda for you or for all users on your computer.
    Advertisement
  3. The Anaconda Navigator app has an icon that resembles a green circle that is dissolving on the right side. You can find the Anaconda Navigator in the Windows Start menu on Windows, or in the Applications folder on Mac. Use one of the following steps to open the Anaconda Navigator:
    • Windows: Click the Windows Start menu and type "Anaconda Navigator." Click the Anaconda Navigator icon.
    • Mac: Click the magnifying glass icon in the upper-right corner of the menu bar at the top. Type "Anaconda Navigator" in the Spotlight search bar. Click the Anaconda Navigator app icon.
  4. It's in the menu panel to the left of the Anaconda Navigator app.
  5. The drop-down menu is at the top of the list of environments in the Anaconda Navigator.
  6. Use the search box in the upper-right corner of Anaconda Navigator that says "Search Package," not the one to the left that says "Search Environments."
  7. It should be the second option in the list. This places an arrow icon in the checkbox.
  8. It's in the lower-right corner of the Anaconda Navigator. This displays a prompt informing you that it is "solving environment." This may take a while, depending on your internet connection. [2]
  9. This installs OpenCV in Anaconda. [3]
  10. Advertisement
Method 2
Method 2 of 4:

Using the Anaconda Prompt in Windows

PDF download Download Article
  1. Python is the programming language Anaconda was written for. If you have not already done so, be sure to install Python . You can download the latest Python installer for Windows, Mac, or Linux at https://www.python.org/downloads/ . Download the Python install and open the installation file. Then follow the instructions to complete the installation.
  2. The Individual Edition of Anaconda is open-source and free to download for all platforms. If you want the Commercial or Enterprise edition, you will need to purchase a license. Use the following steps to download and install the Individual Edition or Anaconda:
    • Visit https://www.anaconda.com/products/individual using a web browser.
    • Click the icon for the operating system you are using below "Get additional Installers".
    • Click the download link that is appropriate for your operating system.
    • Open the installation file in your Downloads folder or web browser.
    • Follow the instructions to complete the installation.
    • Select " Only Me " when asked if you want to install Anaconda for you or for all users on your computer.
  3. The Anaconda Prompt is a Command Prompt environment that is only available for Windows. Use the following steps to open the Anaconda Prompt.
    • Click the Windows Start menu.
    • Type "Anaconda."
    • Click the Anaconda Prompt icon.
  4. This checks for updates to Anaconda and updates you to the latest version of Anaconda.
  5. If you want to install OpenCV in a separate environment, you will need to create it first. Use the following steps to create a new environment:
    • Type conda create --name [environment_name] . Replace "[environment_name]" with the name of the environment you want to create.
    • Press Enter .
    • Type activate [environment_name] and press Enter .
  6. The "conda" command connects to the Anaconda software repository. You can use this command to install Anaconda packages. This command installs OpenCV in your Anaconda environment. [4]
    • Alternatively, you can enter conda install -c conda-forge opencv and press Enter .
    • If you are not able to install OpenCV, it may be that you are using the wrong version of Python or you may need to update Anaconda.
  7. This completes the installation.
  8. Advertisement
Method 3
Method 3 of 4:

Using PIP

PDF download Download Article
  1. Python is the programming language Anaconda was written for. If you have not already done so, be sure to install Python . You can download the latest Python installer for Windows, Mac, or Linux at https://www.python.org/downloads/ . Download the Python install and open the installation file. Then follow the instructions to complete the installation.
  2. The Individual Edition of Anaconda is open-source and free to download for all platforms. If you want the Commercial or Enterprise edition, you will need to purchase a license. Use the following steps to download and install the Individual Edition of Anaconda:
    • Visit https://www.anaconda.com/products/individual using a web browser.
    • Click the icon for the operating system you are using below "Get additional Installers".
    • Click the download link that is appropriate for your operating system.
    • Open the installation file in your Downloads folder or web browser.
    • Follow the instructions to complete the installation.
    • Select " Only Me " when asked if you want to install Anaconda for you or for all users on your computer.
  3. It typically has an icon that resembles a black screen with a white cursor. Use one of the following steps to open the Command Prompt or Terminal:
    • Windows: Click the Windows Start menu and type "CMD." Click the Command Prompt icon in the Windows Start menu.
    • Mac: Click the magnifying glass icon in the upper-right corner of the menu bar at the top. Type "Terminal" in the Spotlight search bar. Click the Terminal icon.
  4. If you want to install OpenCV in a separate environment, you will need to create it first. Use the following steps to create a new environment:
    • Type conda create --name [environment_name] . Replace "[environment_name]" with the name of the environment you want to create.
    • Press Enter .
    • Type activate [environment_name] and press Enter .
  5. PIP is the Python software package library. This command installs OpenCV using PIP.
  6. Advertisement
Method 4
Method 4 of 4:

Using Linux

PDF download Download Article
  1. Anaconda is contains a variety of Python packages. If you have not already installed Python, use the following steps to install Python on Linux: [5]
    • Press Ctrl + Alt + T to open the Terminal.
    • Type python3 --version and press Enter to verify if Python is installed.
    • Type sudo apt-get update and press Enter to update your software library.
    • Type sudo apt-get install python to install Python.
  2. Use the following steps to download the Anaconda installation file:
    • Go to https://www.anaconda.com/products/individual in a web browser.
    • Click the penguin icon below "Get additional installers" to the right.
    • Click 64-Bit (x86) Installer (581 MB) to download the ".sh" file for Anaconda.
  3. To do so, type cd followed by the path that the installation file downloaded to and press Enter . For example, if the installation file is in your Downloads folders, you would type cd Downloads and press Enter to navigate to the Downloads folder in the Terminal.
  4. This grants you permission to execute the installation file.
    • For example, type chmod +x Anaconda3-2021.11-Linux-x86_64.sh to enable the installation file for the 2021 version of Anaconda.
  5. To do so, type ./ followed by the installation file name and press Enter to execute the installation file.
    • For example type ./Anaconda3-2021.11-Linux-x86_64.sh to execute the installation file for the 2021 version of the Anaconda installation file.
  6. This confirms where you want to install Anaconda and installs Anaconda.
  7. This checks for updates to Anaconda and installs the latest version.
    • When prompted, press Y and press Enter .
  8. If you want to install OpenCV in a separate environment, you will need to create it first. Use the following steps to create a new environment:
    • Type conda create --name [environment_name] . Replace "[environment_name]" with the name of the environment you want to create.
    • Press Enter .
    • Type activate [environment_name] and press Enter .
  9. This installs OpenCV using PIP. [6]
  10. Advertisement


Expert Q&A

Ask a Question
      Advertisement

      Tips

      Submit a Tip
      All tip submissions are carefully reviewed before being published
      Name
      Please provide your name and last initial
      Thanks for submitting a tip for review!

      Expert Interview

      Thanks for reading our article! If you’d like to learn more about computer programming, check out our in-depth interview with Kevin Burnett .

      About This Article

      Thanks to all authors for creating a page that has been read 46,425 times.

      Is this article up to date?

      Advertisement