StudyNote -- Install OpenCV in MacOSX for Python support
Compile OpenCV to work with Python support is simple. We need to install numpy, cython and nose to support the OpenCV. I first learnt that there is a great thing that can make the installation easier, the thing is easy_install.
This is quotation from wikipedia
"EasyInstall is a package manager for the Python programming language that provides a standard format for distributing Python programs and libraries (based on the Python Eggs wrapper). easy_install is a module bundled with setuptools, a third-party library meant to enhance the Python standard library's distutils(Distribution utilities).[1] It is analogous to RubyGems for the Ruby programming language.
By default, EasyInstall looks in the Python Package Index (PyPI) for the desired packages and uses the metadata there to download and install the package and its dependencies. It is also hosted itself on the PyPI.
Python Eggs are a way of bundling additional information with a Python project, that allows the project's dependencies to be checked and satisfied at runtime, as well as allowing projects to provide plugins for other projects.
EasyInstall is not a fully fledged package manager. It cannot list local packages nor update them all. Pip and distribute are Python applications designed to fulfil the same role as easy_install. Distribute was created specifically due to the lack of progress in easy_install development. [2] Start from 0.7, EasyInstall merged distribute."There are a few examples about how to use this easy_install
1. If I would like to install a package by its name, easy_install will search PyPI for the latest version, download, build and install. The command is like this
easy_install nose
2. Say, after some time, I would like to update the package nose to the latest version, I can use the command like this
easy_install --upgrade nose
3. Install the a downloaded package from the location in my Mac
easy_install /download/package_name
These are the commands that I used this time, I also found some more example from https://pythonhosted.org/setuptools/easy_install.html
I copy and paste here
Install or upgrade a package by name and version by finding links on a given “download page”:
Download a source distribution from a specified URL, automatically building and installing it:
Install a source distribution that’s already downloaded and extracted in the current directory (New in 0.5a9):
Find a source distribution or Subversion checkout URL for a package, and extract it or check it out to~/projects/sqlobject (the name will always be in all-lowercase), where it can be examined or edited. (The package will not be installed, but it can easily be installed with easy_install ~/projects/sqlobject. See Editing and Viewing Source Packages below for more info.):
Install a distribution within your home dir:
I thought I can use PATH instead of PYTHONPATH, I tried, but when I tried with PATH, Python was not able to import cv. When tried with PYTHONPATH, Python can import both cv and cv2.
When coding, before using OpenCV, remember to import cv2 and/or cv.
DONE, let's rock coding.
