Notes on OpenCV multiversion build

Post date: Dec 19, 2017 6:33:30 PM

There are already many tutorials out there about how to setup OpenCV. For instance, see here. The purpose of this post is about how to manage multiple OpenCV versions on the same system.

The default local build of OpenCV will be installed in

# for the libs

/usr/local/lib/libopencv_*.so

# for the headers

/usr/local/include/opencv

/usr/local/include/opencv2

With python virtual environments, use the following symlinks for the correct python interface

# for non-locally built library, 

ln -s /usr/lib/python2.7/dist-packages/cv2.so ~/env2.7/lib/python2.7/site-packages/cv2.so

# for locally built library,

ln -s /usr/local/lib/python2.7/site-packages/cv2.so ~/env2.7/lib/python2.7/site-packages/cv2.so