Is it possible to run opencv (python binding) from a virtualenv?

前端 未结 4 1276
悲哀的现实
悲哀的现实 2020-12-05 02:45

I would like to keep everything contained within the virtualenv. Is this possible with OpenCV? I\'m fine with building from scratch, do I just need to setup the virtualenv

4条回答
  •  不思量自难忘°
    2020-12-05 03:05

    This is possible by passing the python executable as an argument to cmake. I would also suggest then to use a local install folder, so you don't need sudo at all. And then, if make install doesn't ask you for sudo permissions, it is probably targetting your virtualenv python .

    Open cmakelists.txt with cmake-gui to see the python variables. It would also probably give an error if you don't have numpy in your virtualenv, so that way you know it's choosing the right python. This would also work with independent of python version, as it is built specifically for your python executable

提交回复
热议问题