package opencv was not found in the pkg-config search path for centos

12,318

I know it is really late to answer to a question 4 years later but I will leave it here in hope that it will help someone.

I came also across a similar error after installing OpenCV 3.3.0 on Fedora 26. First, make sure you have the right path to your opencv.pc file. Mine is in this directory '/usr/local/lib/pkgconfig/'.

Run this command in your terminal. It will modify your .bashrc:

echo "#ADD OpenCV in PKG_CONFIG" >> ~/.bashrc
echo "PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:${PKG_CONFIG_PATH}" >> ~/.bashrc
echo "export PKG_CONFIG_PATH" >> ~/.bashrc

Then execute:

source ~/.bashrc
Share:
12,318
lbennet
Author by

lbennet

Updated on June 22, 2022

Comments

  • lbennet
    lbennet almost 2 years

    When I go with this command:

     pkg-config --cflags opencv
    

    I get the following message:

    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
    

    I'm on Cent OS 6, have found the solution for Linux Ubuntu over the internet and here on stack but not for Cent OS

    I tried under OpenCV specifications with

    PKG_CONFIG_PATH=/usr/share/opencv/lib/pkgconfig:${PKG_CONFIG_PATH}
    export PKG_CONFIG_PATH
    

    Still it doesn't work. How can I be sure OpenCV is also installed in that directory, I used whereis opencv and it triggered me /usr/share/