当前位置:网站首页>Resolve importerror:lib*** so--cannot open shared object file: No such... (pycharm/clion reports an error but the shell does not)

Resolve importerror:lib*** so--cannot open shared object file: No such... (pycharm/clion reports an error but the shell does not)

2022-06-13 09:10:00 Glass lamp

Problem description : After successful compilation ( There are executable files in the folder ), Operation error reporting (Ubuntu)Clion The error cannot be found .so Shared library ( but shell Can be executed normally ) terms of settlement (pycharm The same goes for similar error reports )

/home/luoxinhao/Desktop/mywork/bin/Infantry: error while loading shared libraries: libopencv_features2d.so.4.5: cannot open shared object file: No such file or directory

reason :clion The implementation of may be similar to us shell The environment variables are different , Here's the solution

Method 1: Each start Clion Start without mouse , Use terminal , Get into clion In the folder , Input ./clion.sh, Can be executed normally .( Feasible but troublesome )

Method 2: Soft link mode (shell Reporting errors and IDLE Error reporting is feasible , But you may need to link many libraries , One link at a time )

my clion It was successfully modified in this way , however pycharm After linking sevenoreight links, I gave up without finishing the chain

    1.1 file found

            find  /  -name  lib**.so   ( Missing DLL )  

    1.2 Build soft links

            ln -s  /path/to/lib**.so   /usr/lib

     1.3 sudo ldconfig

Method 3: modify LD_LIBRARY_PATH( For me, it can only solve shell Report errors , After modification IDLE Still reporting a mistake )

sudo gedit ~/.bashrc

export LD_LIBRARY_PATH=/where/you/install/lib:$LD_LIBRARY_PATH

sudo source ~/.bashrc

Method 4: modify /etc/ld.so.conf( ditto )

vim  /etc/ld.so.conf

add  /where/you/install/lib

sudo ldconfig

Method 5: Add to environment variable ( You can use , For resolution IDLE Report errors , You may need a matching method 3 Use , Not tried alone )

Start by opening pycharm, Modify the environment variables of the running configuration in the upper right corner

If you already have environment variables , Put a semicolon in the back and paste .

The paste content is similar to the method 3

Such as method 3 The contents are as follows

export LD_LIBRARY_PATH="/opt/intel/openvino_2021.4.689/opencv/lib:$LD_LIBRARY_PATH"

Add... After the semicolon

LD_LIBRARY_PATH=/opt/intel/openvino_2021.4.689/opencv/lib

(2-4 strip ) reference : solve ImportError:lib***.so--cannot open shared object file: No such file or directory_hhhuua The blog of -CSDN Blog

原网站

版权声明
本文为[Glass lamp]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202270533417217.html