解决环境:失败

Solving environment: failed

当我尝试安装 OpenCV3 时显示此错误并且其他库正在安装...

(base) C:\WINDOWS\system32>conda install -c menpo opencv3
Collecting package metadata (current_repodata.json): done
Solving environment: failed
Collecting package metadata (repodata.json): done
Solving environment: failed

UnsatisfiableError: The following specifications were found to be incompatible with each other:

  - _ipyw_jlab_nb_ext_conf -> ipywidgets -> widgetsnbextension[version='>=1.2.3'] -> notebook[version='>=4.2.0'] -> nbconvert -> bleach
  - bleach
  - ipywidgets -> widgetsnbextension[version='>=1.2.3'] -> notebook[version='>=4.2.0'] -> nbconvert -> bleach
  - jupyterlab -> jupyterlab_server[version='>=0.2.0,<0.3.0'] -> notebook -> nbconvert -> bleach
  - jupyterlab_server -> notebook -> nbconvert -> bleach
  - nbconvert -> bleach
  - notebook -> nbconvert -> bleach
  - pip -> python[version='>=3.6,<3.7.0a0']
  - widgetsnbextension -> notebook[version='>=4.2.0'] -> nbconvert -> bleach


创建一个新的 conda 环境并从那里安装 opencv。默认的conda环境很可能存在依赖冲突。

conda create -n opencv4
conda activate opencv4
conda install -c conda-forge opencv

至少这对我有效。

问题是通道优先级很严格。尝试设置以下应该可以解决问题的设置:

conda config --set channel_priority flexible