Installing opencv on Windows 10 with python 3.6 and anaconda 3.6

后端 未结 13 2242
庸人自扰
庸人自扰 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:36

    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

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

    • 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.

    Update on 2018-02-22:

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

    Update on 2019-01-30:

    OpenCV 4.0.1 wheel files are now available in the unofficial site with CPython 3.5/3.6/3.7 support.

    0 讨论(0)
  • 2020-11-29 03:36

    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.

    0 讨论(0)
  • 2020-11-29 03:37

    If you have installed anaconda then you should uninstall it, then try

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

    It worked for me. Thank You.

    0 讨论(0)
  • 2020-11-29 03:38

    I think this way is straight forward. Just install anaconda from official page and follow the image.

    i think this way is straight forward. just install anaconda from official page. and follow the image.

    0 讨论(0)
  • 2020-11-29 03:38

    Using Anaconda3's package manager directly will be more reliable and cross-platform:

    conda install opencv
    
    0 讨论(0)
  • 2020-11-29 03:41

    It's pretty simple..

    Install Anaconda 3.6. Check anaconda is added to System Variable Path.

    Open CMD and type conda install -c conda-forge opencv. This will install latest OpenCV version available (3.6).

    Open IDE editor and try import cv2. It will probably don't work...don't worry.

    You have to add cv2 command to editor.

    For Eclipse (with PyDev):

    Create firs a project and then do the following:

    Eclipse tutorial

    For PyCharm:

    cv2 module probably won't work. Go to the Anaconda folder/Lib/site-packages/cv2 and copy the file cv2.cp36-win_amd64.pyd to the site-packages folder. Rename it cv2.pyd

    Example2

    Now try to write a command... cv2.imread(). If auto-completition don't work, try cv2.cv2.imread(). This will work for sure.

    0 讨论(0)
提交回复
热议问题