Build OpenCV 4 with reference to Anaconda 'environment'

asked 2019-09-30 06:06:35 -0600

Martian gravatar image

I recently noticed a couple articles on building OpenCV using a Conda environment, including this one by Zhanwen Chen on

The idea is that instead of referencing the conventional Anaconda folders via OpenCV Cmake-Gui, you'd create an environment via "conda create ...', and reference the resulting environment folders that are created in Anaconda's 'envs' directory.

That particular article is based on Mac, but one would think that it applies to Linux and Windows as well.

Has anyone tried this? It hadn't occurred to me that it would work, but perhaps there are some advantages.

edit retag flag offensive close merge delete


No comments yet, so perhaps no one has tried this. It's common to create environments with Conda these days, so this seemed logical to me. But I've been using OpenCV with C++, not Python. So perhaps there are some aspects that would not make sense.

Martian gravatar imageMartian ( 2019-10-07 04:42:34 -0600 )edit

Still thinking about going this route, given that virtual envs are the thing these days. If I build OpenCV with a reference to the main Anaconda folders, that would not relate. And I don't think anything about the main install is inherited by a conda env, so it's a matter of building all libraries into the env, then building OpenCV with references to the env's location.

Secondary puzzle: Conda normally builds the env folders under Linux's Home directory. In order to build a globally valid OpenCV, I'd probably need to generate the Conda env in a shared folder, like /opt.

Just kinda thinking out loud in case anyone is at all interested in this. Comments and speculation welcome.

Martian gravatar imageMartian ( 2019-10-09 07:18:52 -0600 )edit