You are not logged in.
Pages: 1
$ pip install opencv-contrib-python
this will not install opencv with opengl support, because apparently it is built by default WITH_OPENGL=OFF.
I went ahead and cloned opencv git and built it myself like such:
$ cmake -S /home/ucha/tmp/opencv -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/home/ucha/.virtualenvs/project/lib/python3.7/site-packages -D WITH_QT=ON -D WITH_OPENGL=ON -D OPENCV_EXTRA_MODULES_PATH=/home/ucha/tmp/opencv_contrib/modules
$ make
$ sudo make install
I thought everything went fine, but then I try to import cv2 and it says "no module named cv2".
I tried
find /home/ucha/.virtualenvs/project cv2.so
and it's nowhere to be found.
what am I doing wrong?
Last edited by uchajk (2019-02-12 03:14:43)
Offline
Any reason you are not using the official package?
Offline
Hello Uchajk,
it's not clear what you want to do, it seems you use a wrong and complex strategy for using opencv in python3 in archlinux,
you have just to install the opencv archlinux package :
https://www.archlinux.org/packages/extra/x86_64/opencv/
this archlinux package will install the opencv python module in this path :
usr/lib/python3.7/site-packages/cv2.cpython-37m-x86_64-linux-gnu.so
then run python3, and type :
import cv2
print(cv2.__version__)
you should see as output :
4.0.1
if you notice a problem with the archlinux package version of opencv then you can custom the PKGBUILD (enabling some options, note that there is already "-DWITH_OPENGL=ON" option in the cmake command, so the openGL option is already activated in the archlinux version of opencv), and rebuild the package, it's easy with makepkg command :
https://git.archlinux.org/svntogit/pack … ges/opencv
Last edited by Potomac (2019-02-11 11:38:30)
Offline
Any reason you are not using the official package?
I wanted to install it in my virtualenv only not globally.
this archlinux package will install the opencv python module in this path :
is there an option to install it in my virtualenv instead? Would I just move the folder from /usr/lib/python3.7/site-packages to ~/.virtualenvs/project/lib/python3.7/site-packages ?
That worked. Thank you!
Last edited by uchajk (2019-02-12 03:13:39)
Offline
Pages: 1