$ conda install -- channel https://conda.anaconda.org/menpo opencv3 error

Asked 2 years ago, Updated 2 years ago, 66 views

Attempting to use OpenCV 3.x on Python 3.x-series Anaconda failed with an error.

What should I do to deal with the following errors?

$conda install --channel https://conda.anaconda.org/menpo openencv3


Fetching package metadata........
Solving package specifications:.

UnsatisfiableError: The following specifications were found to be in conflict:
  - opencv3->python 2.7*->opensl1.0.1*
  - python 3.6*
Use "conda info<package>" to see the dependencies for each package.

opencv anaconda conda

2022-09-30 11:11

1 Answers

I think it is the same problem as reported in Can't install OpenCV3 on Anaconda3 python 3.6 on macOS" of our Stack Overflow home.This conflict occurs because Python 3.6 installed by Anaconda is the new version and the existing package is not able to follow.

Based on Nehal J Wani's Answer, there are three countermeasures.

  • Build your own OpenCV and create your own package.https://github.com/conda-forge/opencv-feedstock
  • Create conda environment for Python 3.5 and install OpenCV 3.x using packages such as menpo/opencv3

    #Check the current Python version $ conda list | grep python python 3.6.12 # Create environment for Python 3.5.x and activate $ conda create-nopencv3 python=3.5 $ source activate opencv3 # Determine the Current Python Version $ conda list | grep python python 3.5.22 # Install menpo/opencv3 in this environment $ conda install-c menpo opencv3
  • Use the opencv package of conda-forge.

    $conda install-conda-forge openencv=3

Create a Python 3.5 conda environment, in which you install OpenCV 3.x using packages such as menpo/opencv3.

#Check the current Python version
$ conda list | grep python
python 3.6.12
# Create environment for Python 3.5.x and activate
$ conda create-nopencv3 python=3.5
$ source activate opencv3
# Determine the Current Python Version
$ conda list | grep python
python 3.5.22
# Install menpo/opencv3 in this environment
$ conda install-c menpo opencv3

Use the conda-forge opencv package.

$conda install-conda-forge openencv=3

Since Python 3.6.1 + OpenCV 3.2.0 is already available in Ubuntu for conda-forge or menpo, a package may be available for macOS, but until then you need to do the above.You can check the conda search command or the Anaconda Cloud Files tab for the default package (you can check the here

).

After installation, you can check the OpenCV version as follows:

import cv2
print(cv2.__version__)


2022-09-30 11:11

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.