Install opencv,used for Python under Mac OSX

Source: Internet
Author: User
Tags image processing library

OpenCV is an open source image processing library with a lot of content.

Want to know a lot of other, please yourself Baidu ~


Blog is recorded under the Mac. Install OPENCV. Then use Python to refer to the OpenCV library.


Environment is:

Python 2.7.5


Easy to use, brew is used to install Opencv,brew is a package manager, very useful, similar to Ubantu apt-get.

If not installed, can see here http://brew.sh/index_zh-cn.html




Then use the following command:


Brew Tap Homebrew/science

Brew Install OpenCV



Homebrew/science, see the name to know, including a lot of scientific research related to the library. Detailed to see here: https://github.com/Homebrew/homebrew-science

During the installation of the Brew install:

Error "Curl: (+) Sslread () return error-9841" can try to change the machine's DNS, can use 8.8.8.8 as DNS.
After a successful installation, the display

zh:~ zhonghuan$ Brew Install opencv==> downloading https://github.com/Itseez/opencv/archive/2.4.9.tar.gz######### ############################################################### 100.0%curl: (+) HTTP server doesn ' t seem to support byte ranges. Cannot resume.==> Trying a full download######################################################################## 100.0%==> CMake. -dcmake_install_prefix=/usr/local/cellar/opencv/2.4.9-dcmake_build==> make==> make install==> CaveatsIf Need Python to find the installed site-packages:  echo '/usr/local/lib/python2.7/site-packages ' > ~/library/ Python/2.7/lib/python/site-packages/homebrew.pth==> Summary


Because the programming language is selected when Python. So, we have to let Python know that OPENCV exists. Watch the installation information at this time.


There is such a sentence:

If you need Python to find the installed site-packages:  echo '/usr/local/lib/python2.7/site-packages ' > ~/library/ Python/2.7/lib/python/site-packages/homebrew.pth


So, let's just do what it says. In the terminal, enter:

echo '/usr/local/lib/python2.7/site-packages ' > ~/library/python/2.7/lib/python/site-packages/homebrew.pth


For a test. Enter Python in the terminal,

Then enter:

Import CV

Import Cv2

Suppose there is no problem. is installed successfully.

Install opencv,used for Python under Mac OSX

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.