【发布时间】:2016-04-13 10:45:03
【问题描述】:
我正在尝试在 Ubuntu 14.04 上安装 OpenCV 3.0 for Python,但经过多次安装(以及读取 StackOverflow 页面)后,它仍然无法正常工作。
在 Python (Python 2.7) 中导入时输入 import cv2 我收到此错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: libopencv_core.so.2.4: cannot open shared object file: No such file or directory
我已经看到这个错误可能是由于文件/etc/ld.so.conf.d/opencv.conf 造成的,因此我在里面写了/usr/local/opencv/ 行,但它没有帮助(实际上我的电脑上没有文件夹opencvin /usr/local/ ...
我按照这个网站上的说明进行安装:http://milq.github.io/install-opencv-ubuntu-debian/
我怀疑在cmake 阶段发生了错误,因为我遇到了像-- Performing Test HAVE_CXX_WMISSING_PROTOTYPES - Failed 这样的故障。我不知道这意味着什么以及它是否对安装很重要......
我还有其他错误,例如
-- checking for module 'gstreamer-base-1.0'
-- package 'gstreamer-base-1.0' not found
在make阶段我得到了这个错误
[ 31%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/qrc_window_QT.cpp.o
In file included from /home/xavier/OpenCV/build/modules/highgui/qrc_window_QT.cpp:9:0:
/home/xavier/OpenCV/build/modules/highgui/qrc_window_QT.cpp: In function ‘int qInitResources_window_QT()’:
/home/xavier/OpenCV/build/modules/highgui/qrc_window_QT.cpp:1749:25: warning: no previous declaration for ‘int qInitResources_window_QT()’ [-Wmissing-declarations]
int QT_MANGLE_NAMESPACE(qInitResources_window_QT)()
^
/usr/include/qt5/QtCore/qglobal.h:100:36: note: in definition of macro ‘QT_MANGLE_NAMESPACE’
# define QT_MANGLE_NAMESPACE(name) name
^
/home/xavier/OpenCV/build/modules/highgui/qrc_window_QT.cpp: In function ‘int qCleanupResources_window_QT()’:
/home/xavier/OpenCV/build/modules/highgui/qrc_window_QT.cpp:1758:25: warning: no previous declaration for ‘int qCleanupResources_window_QT()’ [-Wmissing-declarations]
int QT_MANGLE_NAMESPACE(qCleanupResources_window_QT)()
^
/usr/include/qt5/QtCore/qglobal.h:100:36: note: in definition of macro ‘QT_MANGLE_NAMESPACE’
# define QT_MANGLE_NAMESPACE(name) name
^
[ 31%] Generating opencl_kernels_superres.cpp, opencl_kernels_superres.hpp
你知道哪里错了吗?
【问题讨论】:
-
您似乎已经安装了与 3.0 冲突的旧 OpenCV 版本(2.4.something)
-
是的,可能是这样,但我尝试在安装 3.0 版本之前删除 opencv(使用
sudo find / -name "*opencv*" -exec rm -i {} \;和sudo make unistall)。但也许它没有用。我该怎么办? -
不知道 linux ;D。我只是给你一些可能的问题的指示。