On some machines I ran into "Segmentation fault 11" when I use the OpenCV Python interface on Mac OS X 10.7 Lion. These problem machines were all upgraded from Snow Leopard which had Python 2.6 (Lion has 2.7). Anyway, the simplest solution for me was to do a clean Lion install and then install OpenCV. Here's the whole process, as a big fat "note to self" and hopefully a help for others.
1. Make a clean install of Lion by copying the install .dmg to a DVD or USB stick. See process here.
2. Install Xcode through the Mac App Store.
3. Get the Scipy/Matplotlib/iPython/... stack from the Scipy Superpack.
4. Install Cmake. Download the .dmg from here and run.
4. Download OpenCV, the latest version is 2.3.1.
5. Unpack, open Terminal and go to the folder OpenCV-2.3.1. Run the following commands:
6. Add the build/lib folder that contains cv2.so to your PYTHONPATH.
I have tried this on a number of computers and it works great for me. If you are having OpenCV-Python problems and want to use MacPorts or other variants, the clean Lion install might help as well.
Good luck.
1. Make a clean install of Lion by copying the install .dmg to a DVD or USB stick. See process here.
2. Install Xcode through the Mac App Store.
3. Get the Scipy/Matplotlib/iPython/... stack from the Scipy Superpack.
4. Install Cmake. Download the .dmg from here and run.
4. Download OpenCV, the latest version is 2.3.1.
5. Unpack, open Terminal and go to the folder OpenCV-2.3.1. Run the following commands:
mkdir build
cd build
cmake -G "Unix Makefiles" ..
make -j8
sudo make install
6. Add the build/lib folder that contains cv2.so to your PYTHONPATH.
I have tried this on a number of computers and it works great for me. If you are having OpenCV-Python problems and want to use MacPorts or other variants, the clean Lion install might help as well.
Good luck.