I am trying to install python-opencv. I can see a distribution for Ubuntu 18.04 right here: https://packages.ubuntu.com/bionic/python-opencv

Unfortunately, Ubuntu 20.04 can't see it:

$ sudo apt-get install python-opencv
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python-opencv

How do I overcome this?


You should remember that Ubuntu 20.04 uses python3 by default, because python 2 is considered deprecated.

That's why you should install this package using

sudo apt-get install python3-opencv

But if you really want to use python2 version of this library you can download it using this command

python2 -m pip install opencv-python
  • I am worried that the python 3 version will fail somewhere down the line in this tutorial I'm working through: github.com/RedisGears/EdgeRealtimeVideoAnalytics – Boris K Apr 12 at 17:45
  • 2
    I think it is worth trying to do it using python3. – pktiuk Apr 12 at 17:49
  • I have also added another option if you really want to stick with 2. – pktiuk Apr 12 at 17:50
  • Thank you very much! – Boris K Apr 12 at 19:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.