使用conda安装opencv [英] Install opencv with conda
问题描述
此问题不同于如何通过Conda安装Python OpenCV?"因为这个问题是在5年前提出的,当时所有软件包的版本都不同.我尝试了该问题的所有答案,但均无济于事.有关详细信息,请参阅问题文本.
This question is different from "How do I install Python OpenCV through Conda?" because that question was asked more than 5 years ago, when all packages had different versions. I tried ALL answers to that question, and neither worked. See the text of question for details.
如何在2019年7月立即使用conda安装opencv?在新安装的蟒蛇上,我成功完成了conda update conda
,然后尝试了以下操作:
How to install opencv with conda now, in July 2019? On a freshly installed anaconda, I did conda update conda
(succesfully) then tried the following:
(base) C:\Users\mlearning>python
Python 3.7.3 (default, Mar 27 2019, 17:13:21) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'cv2'
>>> import cv
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'cv'
(base) C:\Users\mlearning>conda install -c menpo opencv3
Collecting package metadata (repodata.json): done
Solving environment: (goes into infinite loop, after 10 minutes I pressed ^C)
(base) C:\Users\mlearning>conda install opencv
Collecting package metadata (repodata.json): done
Solving environment: failed
Initial quick solve with frozen env failed. Unfreezing env and trying again.
Solving environment: failed
UnsatisfiableError: The following specifications were found to be incompatible with each other:
Package zipp conflicts for:
importlib_metadata -> zipp[version='>=0.3.2']
path.py -> importlib_metadata[version='>=0.5'] -> zipp[version='>=0.3.2']
anaconda==2019.03=py37_0 -> importlib_metadata==0.8=py37_0 -> zipp[version='>=0.3.2']
zipp
Package importlib_metadata conflicts for:
anaconda==2019.03=py37_0 -> importlib_metadata==0.8=py37_0
path.py -> importlib_metadata[version='>=0.5']
Package hdf5 conflicts for:
anaconda==2019.03=py37_0 -> h5py==2.9.0=py37h5e291fa_0 -> hdf5[version='>=1.10.4,<1.10.5.0a0']
hdf5
opencv -> hdf5[version='>=1.10.2,<1.10.3.0a0,>=1.8.18,<1.8.19.0a0,>=1.8.20,<1.9.0a0']
h5py -> hdf5[version='>=1.10.1,<1.10.2.0a0,>=1.10.2,<1.10.3.0a0,>=1.10.4,<1.10.5.0a0,>=1.8.18,<1.9.0a0']
pytables -> hdf5[version='>=1.10.1,<1.10.2.0a0,>=1.8.18,<1.8.19.0a0,>=1.8.18,<1.9.0a0']
Package mkl-service conflicts for:
mkl-service
anaconda==2019.03=py37_0 -> mkl-service==1.1.2=py37hb782905_5
(base) C:\Users\mlearning>conda install -c conda-forge opencv
Collecting package metadata (repodata.json): done
Solving environment: failed
Initial quick solve with frozen env failed. Unfreezing env and trying again.
Solving environment: failed
UnsatisfiableError: The following specifications were found to be incompatible with each other:
Package hdf5 conflicts for:
anaconda==2019.03=py37_0 -> hdf5==1.10.4=h7ebc959_0
h5py -> hdf5[version='1.10.1,1.8.17|1.8.17.*,1.8.18|1.8.18.*,>=1.10.2,<1.10.3.0a0,>=1.10.3,<1.10.4.0a0,>=1.8.20,<1.9.0a0']
pytables -> hdf5[version='1.8.18|1.8.18.*,>=1.10.4,<1.10.5.0a0,>=1.8.18,<1.8.19.0a0,>=1.8.18,<1.9.0a0']
hdf5
Package mkl-service conflicts for:
mkl-service
Package importlib_metadata conflicts for:
importlib_metadata
path.py -> importlib_metadata[version='>=0.5']
推荐答案
我在使用conda安装opencv时遇到了无数问题 这是我的方法,如果您还没有环境,请创建一个环境
I have had countless problems with installing opencv with conda This is my approach, create an env if you don't already have one
conda create -n py36 python=3.6
conda activate py36
使用pip
否 conda
pip install opencv-python
如果仍然有问题,请卸载opencv,更新ffmpeg
If your still having an issue, uninstall opencv, update ffmpeg
conda install -c conda-forge ffmpeg
然后重新运行pip
这篇关于使用conda安装opencv的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!