libopencv_core.so.4.5: cannot open shared object file: No such file or directory

1. Specific error report

error while loading shared libraries: libopencv_core.so.4.5: cannot open shared object file: No such file or directory

2. Root cause of the problem

The compiler cannot find the path to the installed opencv library

Reference: Linux multi-version opencv configuration and "cannot open shared object file: No such file or directory" problem solving_Sanduo Senior's Blog-CSDN Blog

3. Solution

  1. Find the path to the specified library

    sudo find / -name "libopencv_core.so.4.5"
    

    Query results (terminal output):/usr/local/opencv4.5.1/lib/libopencv_core.so.4.5

  2. Tell the system the path to the specified library

    sudo gedit /etc/ld.so.conf.d/opencv.conf
    
    # 在文件末尾加上查询结果
    /usr/local/opencv4.5.1/lib/libopencv_core.so.4.5
    
    # 然后运行
    sudo ldconfig -v
    

Guess you like

Origin blog.csdn.net/weixin_37950717/article/details/125222006