0
votes

Good afternoon everyone,

I tried many solutions from other people, but nothing is working. I have downloaded OpenCV, but everytime I run the code it says there is no opencv2 on my computer. And maybe it is important, I am using a Jetson TX2 with Ubuntu 16.04. Here is the error:

File "/usr/local/lib/python3.5/dist-packages/imutils/convenience.py", line 6, in import cv2

ImportError: No module named 'cv2'

In this source, I have the folder 'opencv-3.4.9'

import numpy as np
import sys
sys.path.append('/usr/local/lib/python3.5/dist-packages')
import cv2   

...

I hope someone can help me

2

2 Answers

1
votes

On ubuntu, you can try sudo apt-get install python-opencv to install opencv from pre-built binaries.

Or, you can also visit opencv on Ubuntu for alternative installation instructions.

0
votes

If you are using a virtual environment I strongly recommend this tutorial. If you are trying to install OpenCV systemwide then;

sudo apt-get remove python3-opencv
sudo apt-get install python3-opencv

but above code won't install the latest version. For the latest version you could take a look at this github repo.

I had a jetson nano and it gave me all sorts of trouble about OpenCV. Therefore I recommend the use of virtual environments for these kind of situations. It may take a while to build the libraries in jetson but it is the best-practice.

Best of luck.