Skip to content
Advertisement

Install opencv-python module

I’m trying to install the opencv module without success, I think the problem is related to the version of python I’m using. Indeed I upgraded to the 3.9.1 version but when I’m trying to install the module, I still receive a warning referred to the old version of python I had (i.e. 2.7). How can I get rid of this situation and successfully install the opencv library?

Error in bash

Advertisement

Answer

The issue is because the pip you are using in the insallation command conforms to pip2 which is used for installing packages for python2 (as is evident from the command output). You can verify the version by running:

pip --version

To solve the issue, use pip3:

sudo -H pip3 install opencv-python

If pip3 is not installed, install it via HomeBrew:

brew install python3

It should install pip3 as well. Also, have a look at this.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement