gpt4 book ai didi

python - OpenCV安装报错: No such file or directory "pyopencv_generated_include.h"

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:03:46 24 4
gpt4 key购买 nike

尝试在 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 时遇到了同样的问题。

我们需要手动执行 gen 脚本(从/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

来源:

希望对您有所帮助。

关于python - OpenCV安装报错: No such file or directory "pyopencv_generated_include.h",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52353883/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com