Download Article
Download Article
OpenCV is a tool used for image processing and computer vision. [1] X Research source 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.
Steps
-
Install Python if it's not already installed. 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.
-
Install Anaconda. 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 -
Open the Anaconda Navigator. 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.
-
Click Environments . It's in the menu panel to the left of the Anaconda Navigator app.
-
Use the drop-down menu to select "Not Installed." The drop-down menu is at the top of the list of environments in the Anaconda Navigator.
-
Type opencv in the packages search box. 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."
-
Click the checkbox next to "OpenCV." It should be the second option in the list. This places an arrow icon in the checkbox.
-
Click Apply . 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] X Research source
-
Advertisement
-
Install Python if it's not already installed. 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.
-
Install Anaconda. 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.
-
Open the Anaconda Prompt. 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.
-
Type conda update --all and press ↵ Enter . This checks for updates to Anaconda and updates you to the latest version of Anaconda.
-
Create a new environment (optional). 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 .
-
Type conda install -c menpo opencv and press ↵ Enter . 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] X Research source
- 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.
-
Press y when prompted and press ↵ Enter . This completes the installation.
Advertisement
-
Install Python if it's not already installed. 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.
-
Install Anaconda. 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.
-
Open the Command Prompt or Terminal on your computer. 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.
-
Create a new environment (optional). 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 .
-
Type pip install opencv-python and press ↵ Enter . PIP is the Python software package library. This command installs OpenCV using PIP.
Advertisement
-
Install Python if it is not already installed. 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] X Research source
- 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.
-
Download the Anaconda installation file. 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.
-
Navigate to the Anaconda installation file in the Terminal. 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.
-
Type chmod +x followed by the installation file name and press ↵ Enter . 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.
-
Type the command to execute the installation file. 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.
-
Press y when prompted and press ↵ Enter . This confirms where you want to install Anaconda and installs Anaconda.
-
Type conda update --all and press ↵ Enter . This checks for updates to Anaconda and installs the latest version.
- When prompted, press Y and press Enter .
-
Create a new environment (optional). 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 .
-
Type pip install opencv-python and press ↵ Enter . This installs OpenCV using PIP. [6] X Research source
Advertisement
Expert Q&A
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
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 .
References
- ↑ https://www.analyticsvidhya.com/blog/2021/09/some-amazing-applications-of-opencv-library/
- ↑ https://medium.com/@pranav.keyboard/installing-opencv-for-python-on-windows-using-anaconda-or-winpython-f24dd5c895eb
- ↑ https://www.youtube.com/watch?v=Ms0uuuhQ92Y
- ↑ https://www.geeksforgeeks.org/set-opencv-anaconda-environment/
- ↑ https://docs.python-guide.org/starting/install3/linux/
- ↑ http://web.cecs.pdx.edu/~fliu/courses/cs410/python-opencv.html
About This Article
Thanks to all authors for creating a page that has been read 46,019 times.
Advertisement