OpenCV 安装错误:没有这样的文件或目录"pyopencv_generated_include.h"



尝试在linux 18.0.4中安装OpenCV时,sudo make install命令后,以下错误停止了执行。

[ 83%] Linking CXX executable ../../bin/opencv_perf_stitching
[ 83%] Built target opencv_perf_stitching
[ 83%] Generate files for Python bindings and documentation
[ 83%] Built target gen_opencv_python_source
Scanning dependencies of target opencv_python3
[ 83%] Building CXX object modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.o
/home/kk/opencv-3.4.1/modules/python/src2/cv2.cpp:22:10: fatal error: pyopencv_generated_include.h: No such file or directory
#include "pyopencv_generated_include.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
modules/python3/CMakeFiles/opencv_python3.dir/build.make:62: recipe for target 'modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.o' failed
make[2]: *** [modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.o] Error 1
CMakeFiles/Makefile2:28439: recipe for target 'modules/python3/CMakeFiles/opencv_python3.dir/all' failed
make[1]: *** [modules/python3/CMakeFiles/opencv_python3.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2

知道什么嘶吼吗?

我有CUDA 9.2,Python 3.6.5。查看此处给出的安装说明:https://www.pyimagesearch.com/2018/05/28/ubuntu-18-04-how-to-install-opencv/

我在OpenCV安装过程中遇到了同样的问题。

我们需要手动执行生成脚本(从/build 一级,在我的情况下,从/opencv-3.4.3,为你,基于你的 opencv 版本是/opencv-3.4.1(。

因此,如果您在/build 中:

cd ..
python ./modules/python/src2/gen2.py ./build/modules/python_bindings_generator ./build/modules/python_bindings_generator/headers.txt
cd build
sudo make install

来源:

  • https://github.com/opencv/opencv/issues/10771#issuecomment-376861139
  • https://github.com/opencv/opencv/issues/10771#issuecomment-379949822

希望对您有所帮助。

很抱歉回复晚了,但对于遇到此问题的其他任何人,请尝试检查您将 OpenCV 克隆到的目录名称。

我用一些奇怪的名字把它改成"opencv",然后更新了cmakelist.txt它构建得很好

相关内容

  • 没有找到相关文章

最新更新