【发布时间】:2018-07-28 08:00:09
【问题描述】:
我一直按照此链接中的步骤操作: https://wiki.qt.io/How_to_setup_Qt_and_openCV_on_Windows
我目前正在使用 Qt 5.10 和最新的 OpenCV 3.4.0。我还安装了 Python 3.6.3。
我在步骤 mingw32-make -j 4 遇到了一些错误。
这是我从命令提示符复制的错误:
[100%] Linking CXX shared module ..\..\lib\python3\cv2.cp36-win_amd64.pyd
C:/Users/user/AppData/Local/Programs/Python/Python36/libs/libpython36.a: error adding symbols: File format not recognized
collect2.exe: error: ld returned 1 exit status
modules\python3\CMakeFiles\opencv_python3.dir\build.make:114: recipe for target 'lib/python3/cv2.cp36-win_amd64.pyd' failed
mingw32-make[2]: *** [lib/python3/cv2.cp36-win_amd64.pyd] Error 1
CMakeFiles\Makefile2:4081: recipe for target 'modules/python3/CMakeFiles/opencv_python3.dir/all' failed
mingw32-make[1]: *** [modules/python3/CMakeFiles/opencv_python3.dir/all] Error 2
Makefile:161: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
谁能向我解释我面临什么错误以及如何解决这个问题?有没有我遗漏的文件?
我试图用谷歌搜索错误,但没有得到任何好的解释或解决这个问题。
对不起,我的英语不好,提前致谢。
编辑:我找到了这个链接:https://pypi.python.org/pypi/opencv-python,其中有 cp36-win_amd64.pyd 可供下载。但我确实更改了文件中的任何内容,因为我不确定我目前面临的错误是什么。
Edit2:我发现在这个链接中:https://github.com/opencv/opencv_contrib/issues/971,有人和我有同样的问题。问题还没解决,正在研究中。
Edit3:我已经尝试了 Python 3.6.4 的步骤。也有同样的问题。这是 OpenCV Python 部分的 CMakeList.txt。这是整个 CMakeList.txt : https://github.com/opencv/opencv/blob/master/CMakeLists.txt
if(BUILD_opencv_python3)
status("")
status(" Python 3:")
status(" Interpreter:" PYTHON3INTERP_FOUND THEN "${PYTHON3_EXECUTABLE} (ver ${PYTHON3_VERSION_STRING})" ELSE NO)
if(PYTHON3LIBS_VERSION_STRING)
status(" Libraries:" HAVE_opencv_python3 THEN "${PYTHON3_LIBRARIES} (ver ${PYTHON3LIBS_VERSION_STRING})" ELSE NO)
else()
status(" Libraries:" HAVE_opencv_python3 THEN "${PYTHON3_LIBRARIES}" ELSE NO)
endif()
status(" numpy:" PYTHON3_NUMPY_INCLUDE_DIRS THEN "${PYTHON3_NUMPY_INCLUDE_DIRS} (ver ${PYTHON3_NUMPY_VERSION})" ELSE "NO (Python3 wrappers can not be generated)")
status(" packages path:" PYTHON3_EXECUTABLE THEN "${PYTHON3_PACKAGES_PATH}" ELSE "-")
endif()
status("")
status(" Python (for build):" PYTHON_DEFAULT_AVAILABLE THEN "${PYTHON_DEFAULT_EXECUTABLE}" ELSE NO)
if(PYLINT_FOUND AND PYLINT_EXECUTABLE)
status(" Pylint:" PYLINT_FOUND THEN "${PYLINT_EXECUTABLE} (ver: ${PYLINT_VERSION}, checks: ${PYLINT_TOTAL_TARGETS})" ELSE NO)
endif()
【问题讨论】:
-
我认为Edit2中的问题和你的完全不一样。
-
好的,我试试看线程。
-
@drescherjm,所以根据我在此链接中的理解:gist.github.com/gubatron/32f82053596c24b6bec6。文件格式 .a 是 Mac 和 Linux 的静态库。我会试试 dlltool。
标签: c++ python-3.x qt opencv mingw