Python 我们如何在 anaconda 上安装 opencv?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24400935/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 04:33:06  来源:igfitidea点击:

how could we install opencv on anaconda?

pythonpipanaconda

提问by JonghoKim

I tried to install OpenCV on Anaconda

我试图在 Anaconda 上安装 OpenCV

pip install cv2
pip install opencv
conda install opencv
conda install -c https://conda.binstar.org/jjhelmus opencv

(refered here Anaconda doesn't find module cv2)

(参考此处Anaconda 未找到模块 cv2

but all failed. Does anybody know how to install this?

但都失败了。有人知道如何安装吗?

采纳答案by Harsh Kumar Narula

Run the following command:

运行以下命令:

conda install -c https://conda.binstar.org/menpo opencv

I realized that opencv3 is also available now, run the following command:

我意识到 opencv3 现在也可用了,运行以下命令:

conda install -c https://conda.binstar.org/menpo opencv3

Edit on Aug 18, 2016: You may like to add the "menpo" channel permanently by:

2016 年 8 月 18 日编辑:您可能希望通过以下方式永久添加“menpo”频道:

conda config --add channels menpo

And then opencv can be installed by:

然后可以通过以下方式安装opencv:

conda install opencv(or opencv3)

Edit on Aug 14, 2017: "clinicalgraphics" channel provides relatively newer vtk version for very recent python3

2017 年 8 月 14 日编辑:“临床图形”频道为最近的 python3 提供了相对较新的 vtk 版本

conda install -c clinicalgraphics vtk

回答by JonghoKim

I guess

我猜

http://answers.opencv.org/question/17536/install-opencv-for-anaconda-ipython/

http://answers.opencv.org/question/17536/install-opencv-for-anaconda-ipython/

it would be an answer

这将是一个答案

If you compile OpenCV from source, and Anaconda is your default python interpretor 
(CMake rule PYTHON_PACKAGES_PATH = C:\Anaconda\Lib\site-packages), 
then the install rule will copy cv2.pyd to C:\Anaconda\Lib\site-packages.
Otherwise, you could do it manually, and make sure OpenCV libs are in the PATH.

Still I don't know what is CMake rule(?) and "install rule".

我仍然不知道什么是 CMake 规则(?)和“安装规则”。

回答by knightcube

Firstly go to your anaconda folder. The path in my case was - C:\Users.....\Anaconda3 . Then go to the Scripts folder. Open this link- http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv. Download this file - opencv_python-3.2.0-cp36-cp36m-win_amd64.whl from the link and copy paste it into your Scripts folder inside Anaconda3 folder. Now go to spyder and type this, import cv2 If everything works out it wont show any error and congrats you just installed it successfully.

首先转到您的anaconda文件夹。在我的情况下,路径是 - C:\Users.....\Anaconda3 。然后转到脚本文件夹。打开此链接 - http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv。从链接下载此文件 - opencv_python-3.2.0-cp36-cp36m-win_amd64.whl 并将其复制粘贴到 Anaconda3 文件夹内的 Scripts 文件夹中。现在去 spyder 并输入这个,导入 cv2 如果一切正常,它不会显示任何错误,恭喜你刚刚安装成功。

回答by Kumar Gaurav

Anaconda Python OpenCV-----------------

Anaconda Python OpenCV-----------------

  1. Remove all previous/current (if any) python installation
  2. Install Anaconda and add anaconda to PATH(Envirnoment variables:: Adavanced system setting->Environment variables->under system variables go to variable PATHand click edit to add new envirnomental variables) (During installation check box involve PATH)
  3. Open anaconda prompt with admin access. Type and enter:-
    conda update --all
  4. conda install -c conda-forge opencv (for opencv)
  5. conda install spyder=4.0.0 (spyder updation)
  6. conda update python (for python updation)
  1. 删除所有以前/当前(如果有)python 安装
  2. 安装Anaconda并将anaconda添加到PATH(环境变量::高级系统设置->环境变量->在系统变量下转到变量PATH并单击编辑添加新的环境变量)(安装时复选框涉及PATH)
  3. 以管理员权限打开 anaconda prompt。输入并输入:-
    conda update --all
  4. conda install -c conda-forge opencv(用于 opencv)
  5. conda install spyder=4.0.0(spyder 更新)
  6. conda update python(用于python更新)