randomcastle
randomcastle

Reputation: 111

Pip cannot locate opencv

I am trying to install xbob.flandmarks using "pip install xbob.flandmark". When I do so I get the following error:

RuntimeError: PkgConfig did not find package opencv. Output:

Package opencv was not found in the pkg-config search path.

Perhaps you should add the directory containing `opencv.pc'

to the PKG_CONFIG_PATH environment variable

No package 'opencv' found

This is a somewhat common error (see here and here). I have tried the solution these links propose (adding the opencv.pc file to my PKG_CONFIG_PATH both by exporting it in the shell (export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/Cellar/opencv/2.4.8.2/lib/pkgconfig/) and by adding the line to my ~/.bashrc file. I have also tried using the opencv.pc file stored in the homebrew Cellar as well as in /usr/local/lib/pkgconfig.)

Any suggestions would be greatly appreciated.

Upvotes: 1

Views: 2190

Answers (2)

The Peter Overbury
The Peter Overbury

Reputation: 11

I would got with pip install opencv-contrib-python

The opencv-contrib-python repository contains both the main modules along with the contrib modules — this is the library I recommend you install as it includes all OpenCV functionality. This could make sure you cover the stuff making your error above.

Ref: https://www.pyimagesearch.com/2018/09/19/pip-install-opencv/

Upvotes: 1

Type pip install opencv-python.

It should be good.

Upvotes: 1

Related Questions