Ask Your Question

Can OpenCV2 and OpenCV3 be installed togheter?

asked 2015-08-18 22:31:05 -0600

luisruiz gravatar image

I have OpenCV 2.4.11 and now I am porting some of my codes to OpenCV3, in the meanwhile I still have to do work on 2.4.11. So I have been installing and uninstalling, going back and forth between 2.4.11 and 3. Is there a way to have both installed and select which one to use? e.g. at compilation time?, that will help me a lot. What has to be done? How to select them?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-08-18 22:35:10 -0600

unxnut gravatar image

Certainly, you can have multiple instances of OpenCV installed and being used concurrently. You will have to adjust some environment variables. For example, on Windows, you will have to change the value in PATH to point to correct directory for DLLs. Same on Linux. Much easier than installing/uninstalling the entire package.

edit flag offensive delete link more


Thanks!! I am on the part about setting the environment variables. I got the two installations (opencv 2 and 3) working but I was wondering if there is a way to set the environment variables automatically. Right now I change them in the .bashrc file depending on which version I will be using.

luisruiz gravatar imageluisruiz ( 2015-08-19 01:51:26 -0600 )edit

You can do that in Makefile if you are using one.

unxnut gravatar imageunxnut ( 2015-08-19 10:22:26 -0600 )edit

In my experience, on Linux Ubuntu, the fastest way is to build both versions and keep the build folders somewhere on your system. Whenever you want to install a specific version, run sudo make -j 6 install inside that build folder. This will automatically change all links and environment variables.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-08-20 04:29:42 -0600 )edit

Question Tools

1 follower


Asked: 2015-08-18 22:31:05 -0600

Seen: 7,205 times

Last updated: Aug 18 '15