Installing opencv on Windows 10 with python 3.6 and anaconda 3.6

后端 未结 13 2226
庸人自扰
庸人自扰 2020-11-29 03:11

How to install opencv with python 3.6 and anaconda 3.6?

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

but i get the following

13条回答
  •  清酒与你
    2020-11-29 03:43

    I am using python 3.6 and the following worked for me:

    • Download and install opencv (Win pack) on your computer from the official website: https://opencv.org/releases.html (I took version 3.4.2)
    • Go to the website of Christoph Gohlke and download the wheel file corresponding to your system. (I took opencv_python-3.4.2-cp36-cp36m-win_amd64.whl)
    • As mentioned on the website of Christoph Gohlke, make sure you installed 'numpy1.14' & 'mkl' package. Also make sure you use pip with version 9 or newer.
    • Start the 'Anaconda Prompt'
    • Change the directory in the 'Anaconda Prompt' to the folder where you downloaded the wheel file from Gohlke's website (via the MS-DOS command 'cd').
    • In the 'Anaconda Prompt' type 'pip install opencv_python-3.4.2-cp36-cp36m-win_amd64.whl') (change the name of the wheel file accordingly).

    When starting spyder, test your installation as follows:

    import cv2
    print(cv2.__version__)
    

    If the version is printed in the console (in my case 3.4.2), your installation was successful.

    IMPORTANT REMARK: If you created a dedicated environment within Anaconda (in my case 'py36'), make sure you installed spyder for this dedicated environment ('conda install spyder'). If not, your installation of opencv will not be recognised within the environment you are working in. Maybe this is obvious and straightforward but in my case I struggled to find this solution.

提交回复
热议问题