Installing opencv on Windows 10 with python 3.6 an

2019-01-08 13:44发布

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 error:

UnsatisfiableError: The following specifications were found to be in conflict:
  - opencv3 -> python 2.7*
  - python 3.6*
Use "conda info <package>" to see the dependencies for each package.

I am using Windows 10 64-bit, with python 3.6, and anaconda 3.6 installed.

Is it even available for python3.6 at the moment or should i rollback my python version to 3.5.*?

11条回答
看我几分像从前
2楼-- · 2019-01-08 14:13

From menpo file page, it shows that the OpenCV 3.2 binary there are only for Python 2.7/3.4/3.5 and on linux-64 platform

enter image description here

You may go to the this site to get the exact version you need.

Available OpenCV3.2 binary for Windows

  • opencv_python‑3.2.0‑cp36‑cp36m‑win_amd64.whl is the basic one.
  • opencv_python‑3.2.0+contrib‑cp36‑cp36m‑win_amd64.whl is the one with opencv-contrib modules such as the text module for binding to tesseract OCR engine and many others.

Both binary are for OpenCV 3.2 with Python 3.6 binding for Windows 64-bit. To install it, 1) download the binary to local drive, 2) open your Anaconda command prompt and 3) type the command below in the directory the binary locates.

pip install opencv_python‑3.2.0+contrib‑cp36‑cp36m‑win_amd64.whl

Hope this help.

enter image description here

Update on 2018-02-22:

OpenCV 3.4.0 wheel files are now available in the unofficial site and replaced OpenCV 3.3.0

查看更多
趁早两清
3楼-- · 2019-01-08 14:13

I managed to get it working by doing the following:

  1. Download and install python3.6 from official python site https://www.python.org/downloads/release/python-360/

  2. Download and install Anaconda 4.4.0 from the official anaconda site https://www.continuum.io/downloads

  3. Open command line and run: pip install opencv-python

  4. Open command line and run: pip install opencv-contrib-python

    I am using Windows 10 and it worked for me.

查看更多
家丑人穷心不美
4楼-- · 2019-01-08 14:13

I am using Python 3.6.2 and Anaconda 4.3.23 (It should also work with your case).

I did the following:

  • Download the Numpy version corresponding to your Python installation from here. In my case, I’ve used numpy-1.13.1+mkl-cp36-cp36m-win_amd64.whl

  • Download the OpenCV version corresponding to your Python installation from here. In my case, I’ve used opencv_python-3.3.0-cp36-cp36m-win_amd64.whl

  • Now go to the folder where you downloaded these files and run the following:

    pip install numpy-1.13.1+mkl-cp36-cp36m-win_amd64.whl

    pip install opencv_python-3.3.0-cp36-cp36m-win_amd64.whl

Note the Successfully installed … message after each command.

At this point, you should be able to play with OpenCV and Python. Let’s try a small test first. Start the Python interpreter or Jupyter Notebook and write:

import cv2 
print(cv2.__version__)

If everything was correctly installed, you should see the version number of your OpenCV install, in my case this was 3.3.0.

查看更多
趁早两清
5楼-- · 2019-01-08 14:14

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.

查看更多
Root(大扎)
6楼-- · 2019-01-08 14:17

As of March 2018, OpenCV 3.4 can be installed directly from conda-forge or anaconda in Windows/OSX/Linux for Python 3.6

conda install -c https://conda.anaconda.org/conda-forge opencv

or

conda install -c anaconda opencv

enter image description here

查看更多
贼婆χ
7楼-- · 2019-01-08 14:19

search anaconda prompt
open and run the command.

> pip install opencv-python

this single command help's you to install opencv easily.
you can take help from the video link below. video link

查看更多
登录 后发表回答