Anaconda安装opencv3遇UnsatisfiableError冲突,求解决方法
Hey there, let's work through this dependency conflict issue you're facing with Conda. The error pops up because the opencv3 package from the Menpo channel is pretty outdated, and it doesn't play nice with the version of zict already in your Python 3.6 environment—especially since you have TensorFlow and NumPy installed too. Let's go through some practical, actionable solutions:
Option 1: Use the Conda-Forge Channel for OpenCV (Recommended)
The Conda-Forge channel is way more actively maintained than Menpo, so its packages are far more likely to play nicely with your existing dependencies. Here's what to do:
- First, clean up any partially installed conflicting
opencv3package:conda remove --force opencv3 - Then install a compatible OpenCV 3.x version from Conda-Forge:
Specifyingconda install -c conda-forge opencv=3.4.* python=3.63.4.*ensures you get the latest OpenCV 3 release that supports Python 3.6, and Conda will automatically resolve compatible versions for zict and other linked packages.
Option 2: Create a Fresh Virtual Environment (Most Stable)
Since you already have TensorFlow and NumPy installed, your current environment might have a tangled web of dependencies. Creating a new isolated environment avoids breaking your existing setup entirely:
- Create the new environment with all the packages you need, pre-configured for compatibility:
conda create -n cv_tensorflow_env python=3.6 tensorflow numpy opencv=3.4 -c conda-forge - Activate the environment to start using it:
This way, all packages are installed with compatible versions from the get-go, no conflicts included.conda activate cv_tensorflow_env
Option 3: Force a Compatible Zict Version (Less Reliable)
If you really need to stick with the Menpo version of opencv3, you can try specifying an older zict version that it's compatible with. Run this command to install both together:
conda install -c menpo opencv3 zict=0.1.*
Note that this is hit-or-miss since Menpo's packages aren't regularly updated, so you might still run into unexpected conflicts.
Quick Tips to Avoid Headaches
- Don't uninstall zict directly—it's probably a dependency for other tools (like Dask or Distributed) in your environment, so removing it could break other software you're using.
- Python 3.6 is end-of-life, so if your TensorFlow version allows it, consider upgrading to Python 3.8 or higher for better long-term package compatibility.
- Before making big changes, backup your current environment with
conda env export > environment.yml—this lets you restore it if something goes wrong.
内容的提问来源于stack exchange,提问作者Pirate X

