在ubuntu下编译opencv程序后,执行报下面到错误:error while loading shared libraries: libopencv_core.so.2.4: cannot open shared object file: No such file or directory解决方法:找到libopencv_开头到库的目录,在/usr/local/lib下面,在/etc/ld.so.conf.d/下面新建一个opencv.conf,里面写入/usr/local/lib,最后执行
查看文件: vim ~/.bash_profile 在bash_profile文件下以编辑模式插入以下代码:其中,/xxx/myname即为要设置的默认路径 SYSTEM=`uname -s` case $SYSTEM in Linux) alias ls="ls --color" esac cd /xxx/myname 退出编辑模式:按esc,在编辑模式插入如下代码 :wq 退出后,写入如下代码: source ~/.bash_profile 完美~