How can I install CUDA and OpenCV on Jetson TX2?

Hello, I have a problem. I installed the latest version of JetPack. CUDA and OpenCV were installed with the JetPack SDK. I couldn’t compile my project with them after it was founded. For example, object recognition with YOLO.

“not found cv2” for OpenCV. The other one is that when I compile it with CUDA, there are too many fatal errors.

I tried to install it manually. But I faced similar troubles.

How can I install CUDA and OpenCV on Jetson TX2 ?


CUDA and OpenCV is preinstalled.
So you don’t need to install it manually.

Please noticed that the OpenCV version in our latest JetPack is v4.1.1.
The header path is different from v3.x that changed to /usr/include/opencv4/.


I cannot run a snippet of code that I have included OpenCV 4.1.1. What should I do?


Could you share a compile error or runtime error with us first?


Would you share an output of pkg-config command?
$ pkg-config --libs opencv

If opencv package is not found, you may configure PKG_CONFIG_PATH for your Jetson TX2.

You may try this:
$ echo “export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/pkgconfig” >> ~/.bashrc
$ source ~/.bashrc
$ sudo ln -s /usr/lib/pkgconfig/opencv4.pc /usr/lib/pkgconfig/opencv.pc

@MtHiker thanks for information. I solved the problem before your sharing.

Good to hear that