简体   繁体   中英

Install OpenCV on Python 3.5 with Conda

I tried to install OpenCV Conda with Python 3.5.

I read this and also tried the solutions but nothing worked. I guess that this is because OpenCV hasn't been supported by Python 3.5 yet, does it?

Maybe someone of you knows a solution? Or, do I have to use an earlier version of Python (v2.7)?

I have installed OpenCV using python 2.7 version.

You have to use the command conda install opencv in the command prompt.

If you want a particular version of OpenCV mention the version as follows:

conda install opencv=3.0.0

i just use below command, and it works for me. ( windows 10 pro 64-bit, Anaconda 4.6.8, Spyder 3.3.2)

(base) C:\\Windows\\system32> conda install opencv

output like this:

=============================================

Collecting package metadata: done

Solving environment: done

Package Plan

environment location: C:\\ProgramData\\Anaconda3

added / updated specs: - opencv

The following packages will be downloaded:

package                    |            build
---------------------------|-----------------
libopencv-3.4.1            |       h875b8b8_3        37.0 MB
opencv-3.4.1               |   py37h6fd60c2_3           9 KB
py-opencv-3.4.1            |   py37h1b0d24d_3         1.5 MB
------------------------------------------------------------
                                       Total:        38.5 MB

The following NEW packages will be INSTALLED:

libopencv pkgs/main/win-64::libopencv-3.4.1-h875b8b8_3

opencv pkgs/main/win-64::opencv-3.4.1-py37h6fd60c2_3

py-opencv pkgs/main/win-64::py-opencv-3.4.1-py37h1b0d24d_3

Proceed ([y]/n)? y

Downloading and Extracting Packages

py-opencv-3.4.1 | 1.5 MB | ################################### | 100%

opencv-3.4.1 | 9 KB | ################################### | 100%

libopencv-3.4.1 | 37.0 MB | ################################### | 100%

Preparing transaction: done

Verifying transaction: done

Executing transaction: done

============================================================================

finally, i tested it in IPython console and Spyder editor and run, both of them works fine.

The use of conda install , as posted earlier, is the way I would prefer. However, if it didn't work, you might consider using Homebrew, as outline in this webpage .

## Install latest Homebrew, if haven't already
which brew #command line; check if installed
## Run the line below in command line terminal
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

## Since you already have python3, no installation necessary
## Install gcc
brew install gcc
## Install necessary python packages
sudo pip3 install -U numpy scipy matplotlib scikit-learn scikit-image

## OpenCV3, specific for python 3
## and "register" to your machine
brew install opencv3 --with-python3
ln -s /usr/local/opt/opencv3/lib/python3.5/site-packages/cv2.cpython-35m-darwin.so /usr/local/lib/python3.5/site-packages/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM