Install openCV, used for python, and osxopencv in mac osX

Source: Internet
Author: User
Tags image processing library

Install openCV, used for python, and osxopencv in mac osX

OpenCV is an open-source image processing library with a large amount of content. For more information, see Baidu ~


A blog is recorded on a mac, installed with openCV, and then used python to reference the openCV library.


Environment:

Python 2.7.5


It is convenient to use brew to install openCV, and brew is a package manager, which is very easy to use, similar to apt-get of ubantu.

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




Run the following command:


Brew tap homebrew/science

Brew install opencv



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

During brew install installation, the following error occurs:

Error "curl: (56) SSLRead () return error-9841"You can try to modify the DNS of the machine and use 8.8.8.8 as the dns.
After the installation is successful

ZH:~ zhonghuan$ brew install opencv==> Downloading https://github.com/Itseez/opencv/archive/2.4.9.tar.gz######################################################################## 100.0%curl: (33) 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 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==> Summary


Because python is selected as the programming language, we need to let python know the existence of opencv. Observe the installation information.


Here is 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 we can just follow what it says and enter the following in the terminal:

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


To test, input python in the terminal,

Then enter:

Import cv

Import cv2

If no problem exists, the installation is successful.


I just installed python for mac27 in mac, but I still need a graphics library for learning. I copied the library in win to the python folder.

Download and install XCODE directly. The official integrated development environment is free and easy to use. It also comes with various language development tools, including python, perl, c, c ++, objc, and so on.

An error occurred while installing mysql for python in mac environment.

You need to install Command Line Tools of Xcode.
Developer.apple.com/downloads/index.action
You need to log on with an Apple Developer account
At the same time, make sure that mysql installed on the machine is normal. Otherwise, another error occurs when you install MySQL-python.

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.