Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Build and install the Python 3 module

I built OpenCV 4.x from a git checkout with the necessary options to build the Python 3 module. The configuration output includes:

--   OpenCV modules:
--     To be built:                 ... python2 python3 ...

--   Python 3:
--     Interpreter:                 /blah/.venv/bin/python3 (ver 3.6.5)
--     Libraries:                   /blah/python-3.6.5/lib/libpython3.6m.so (ver 3.6.5)
--     numpy:                       /blah/.venv/lib/python3.6/site-packages/numpy/core/include (ver 1.17.0)
--     install path:                /blah/.venv/lib/python3.6/site-packages

So it looks good. When I compile, it creates the file lib/python3/cv2.cpython-36m-x86_64-linux-gnu.so.

However, I can't figure out how I'm supposed to install this. I've tried cmake --build . --target install. This does not even install the Python 3 .so file to the install prefix, it only copies lib/python2.7/site-packages/cv2.so.

Can I create an egg or something installable from my build?

Build and install the Python 3 module

I built OpenCV 4.x from a git checkout with the necessary options to build the Python 3 module. The configuration output includes:

--   OpenCV modules:
--     To be built:                 ... python2 python3 ...

--   Python 3:
--     Interpreter:                 /blah/.venv/bin/python3 (ver 3.6.5)
--     Libraries:                   /blah/python-3.6.5/lib/libpython3.6m.so (ver 3.6.5)
--     numpy:                       /blah/.venv/lib/python3.6/site-packages/numpy/core/include (ver 1.17.0)
--     install path:                /blah/.venv/lib/python3.6/site-packages

So it looks good. When I compile, it creates the file lib/python3/cv2.cpython-36m-x86_64-linux-gnu.so. inside the build directory.

However, I can't figure out how I'm supposed to install this. I've tried cmake --build . --target install. This does not even install the Python 3 .so file to the install prefix, it only copies lib/python2.7/site-packages/cv2.so.

Can I create an egg or something installable from my build?