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?

1 Answer 1


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, 2021 at 17:45
  • 2
    I think it is worth trying to do it using python3.
    – pktiuk
    Apr 12, 2021 at 17:49
  • I have also added another option if you really want to stick with 2.
    – pktiuk
    Apr 12, 2021 at 17:50
  • Thank you very much!
    – Boris K
    Apr 12, 2021 at 19:35
  • I use Ubuntu 20.04, but the above command for python3 dint install opencv for me. No error msg was shown either. Is there anyother way? Aug 15, 2021 at 12:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .