Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to activate OpenCV on python3 #28

Open
Ata1362 opened this issue May 6, 2019 · 7 comments
Open

How to activate OpenCV on python3 #28

Ata1362 opened this issue May 6, 2019 · 7 comments

Comments

@Ata1362
Copy link

Ata1362 commented May 6, 2019

No description provided.

@Ata1362 Ata1362 changed the title how to active openCV on python3 How to active OpenCV on python3 May 6, 2019
@Ata1362 Ata1362 changed the title How to active OpenCV on python3 How to activate OpenCV on python3 May 6, 2019
@Ata1362
Copy link
Author

Ata1362 commented May 6, 2019

hi guys,
I followed the instruction and codes worked just perfect.
I have python 2 and 3 both installed on my Jetson tx2 and they are working fine.
after installing the OpenCV the CV2 is only can be import in Python2 NOT 3.
How can I make python3 to recognize or find the LIB files.
I tried to find the files and maybe copy them to the same directory for python3 but I could not find files.
BTW I have installed the opencv all in default directories.
Kindly please advise.
thank you.

@Ata1362
Copy link
Author

Ata1362 commented May 6, 2019

I found the files and libs installed on my Jetson.
btw, I'm still looking forward to find out how can make python3 to recognize CV2

@majiang2018
Copy link

i think,you can copy file to

$ sudo cp /usr/local/lib/python3.5/site-packages/cv2.cpython-35m-aarch64-linux-gnu.so /usr/local/lib/python3.5/dist-packages/cv2.so

$ ls /usr/local/lib/python3.5/dist-packages/cv2.*
/usr/local/lib/python3.5/dist-packages/cv2.cpython-35m-aarch64-linux-gnu.so
$ ls /usr/local/lib/python2.7/dist-packages/cv2.*
/use/local/lib/python2.7/dist-packages/cv2.so
$ python3 -c 'import cv2; print(cv2.version)'
3.4.1-dev
$ python2 -c 'import cv2; print(cv2.version)'
3.4.1-dev

@majiang2018
Copy link

@majiang2018
Copy link

majiang2018 commented Sep 8, 2020

you need use nvidia sdkmanage update os to ubuntu18.04

update ./buidOpenCVTX2.sh file

OPENCV_VERSION=4.2.0

time cmake -D CMAKE_BUILD_TYPE=RELEASE
-D CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
-D WITH_CUDA=ON
-D CUDA_ARCH_BIN=${ARCH_BIN}
-D CUDA_ARCH_PTX=""
-D ENABLE_FAST_MATH=ON
-D CUDA_FAST_MATH=ON
-D WITH_CUBLAS=ON
-D WITH_LIBV4L=ON
-D WITH_GSTREAMER=ON
-D WITH_GSTREAMER_0_10=OFF
-D WITH_QT=ON
-D WITH_OPENGL=ON
-D OPENCV_EXTRA_MODULES_PATH=/home/nvidia/opencv_contrib/modules
-D CUDNN_LIBRARY=/usr/local/cuda/lib64/libcudnn.so.8.0.0
-D CUDNN_VERSION='8.0'
../

@Ata1362
Copy link
Author

Ata1362 commented Sep 10, 2020

Thank you for answering my question. I appreciate it a lot.
I have removed my Python2, and nowadays, I only use python3, and works just perfect.
I hope that your answer will help those that are still having two pythons on their system.

@berkantay
Copy link

berkantay commented Dec 3, 2020

Hello @Ata1362 did @majiang2018 's solution work for opencv_contrib?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants