I first used the BUILD_PYTHON=ON in cmake method. But it didn't work.
Again I used MacPort.
sudo port install opencv +python27
This gave this result.
---> Computing dependencies for opencv ---> Deactivating opencv @2.4.3_4+python26 ---> Cleaning opencv ---> Activating opencv @2.4.3_4+python27 ---> Cleaning opencv ---> Scanning binaries for linking errors: 100.0% ---> No broken files found.
After this I opened python and entered-
>>>import cv
But it gave the below error
Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named cv