使用anaconda安装opencv

时间:2017-02-20 20:50:35

标签: python c++ opencv ubuntu anaconda

我有opencv 3.1(从源代码构建)在Ubuntu中运行得非常好。然而,在我从anaconda(conda install -c menpo opencv3 = 3.2.0)安装了opencv 3.2的python版本后,我遇到以下警告/错误:

  

/ usr / bin / ld:警告:libjpeg.so.9,需要   //home/sss/anaconda3/lib/libtiff.so.5,找不到(尝试使用-rpath或   -rpath链路)

     

// home / sss / anaconda3 / lib / libtiff.so.5:未定义的引用   ' jpeg_finish_decompress@LIBJPEG_9.0'

     

// home / sss / anaconda3 / lib / libtiff.so.5:未定义的引用   ' jpeg_set_quality@LIBJPEG_9.0'

     

...

这是我的cmake文件,我跟踪了一些在线资源。

cmake_minimum_required(VERSION 2.8)
project( test )

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

find_package( OpenCV REQUIRED )

message(STATUS "OpenCV library status:")
message(STATUS "    version: ${OpenCV_VERSION}")
message(STATUS "    libraries: ${OpenCV_LIBS}")
message(STATUS "    include path: ${OpenCV_INCLUDE_DIRS}")
message(STATUS "    library path: ${OpenCV_LIB_DIR}")

include_directories( ${OpenCV_INCLUDE_DIRS} )

add_executable( testcv main.cpp )
target_link_libraries( testcv ${OpenCV_LIBS} )
  

- OpenCV库状态:

     

- 版本:3.1.0

     

- 图书馆:

     

opencv_xphoto; opencv_xobjdetect; opencv_ximgproc; opencv_xfeatures2d; opencv_tracking; opencv_text; opencv_surface_matching; opencv_structured_light; opencv_stereo; opencv_saliency; opencv_rgbd; opencv_reg; opencv_plot; opencv_optflow; opencv_line_descriptor; opencv_hdf; opencv_fuzzy; opencv_face; opencv_dpm; opencv_dnn; opencv_datasets; opencv_ccalib; opencv_bioinspired; opencv_bgsegm ; opencv_aruco; opencv_videostab; opencv_videoio; opencv_video; opencv_superres; opencv_stitching; opencv_shape; opencv_photo; opencv_objdetect; opencv_ml; opencv_imgproc; opencv_imgcodecs; opencv_highgui; opencv_flann; opencv_features2d; opencv_core; opencv_calib3d

     

- 包含路径:/ usr / local / include / opencv; / usr / local / include

     

- 库路径:/ usr / local / share / OpenCV / 3rdparty / lib

     

- 配置完成

     

- 生成完成

     

- 构建文件已写入:/ home / sss / Project / OpenCV / Test01 / build

所有opencv库都位于" / usr / local / lib"内,并且只有一个文件" libippicv.a"在文件夹" / usr / local / share / OpenCV / 3rdparty / lib"中。我尝试添加SET(OpenCV_LIB_DIR" / usr / local / lib"),编译错误仍然存​​在。

我的main.cpp只包含两个opencv行:

Mat image;
image = imread("lena.jpg",1);

如果我评论第二行(imread),那么构建就会成功。

似乎以某种方式在anaconda内部安装opencv对系统进行了一些外部更改,但它们是什么?如何才能让我的opencv重新开始工作?

更新

我通过重定向链接找到了一种临时方式:

export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu

但之前改变了什么?以及如何在cmake中正确地做到这一点?

更新

它再次停止工作。虽然我可以构建它,但是一旦我运行该程序,它就会不断询问ligjpeg.so.9。

加载共享库时出现

"错误:libjpeg.so.9:无法打开共享对象文件:没有这样的文件或目录"

如何解决?

0 个答案:

没有答案