I wanted to install Opencv and followed this tutorial : https://medium.com/@sourabhjigjinni/install-opencv-4-0-0-for-c-windows-7-10-code-blocks-tdm-gcc-64-dff65addf162
I followed it step by step, built it in code blocks, but at about 99% built i got the error : fatal error : Python.h : no such file or directory.
Pc : Windows 10, 64 bit, python3 installed.
I added the full path to the python include directory in the compiler's "search directories" section. I checked if the path to python.exe and to the include directory were filled while generating the Makefiles with Cmake. I aslo checked lots of forums but never found a satisfying answer...
[ 99%] Building CXX object modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.obj
cd /d C:\opencv\build\modules\python3 && C:\TDM-GCC-64\bin\g++.exe -DCVAPI_EXPORTS -D_USE_MATH_DEFINES -D__OPENCV_BUILD=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS @CMakeFiles/opencv_python3.dir/includes_CXX.rsp -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -Wno-long-long -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -Wno-unused-function -Wno-deprecated-declarations -Wno-overloaded-virtual -Wno-undef -O3 -DNDEBUG -DNDEBUG -std=c++11 -o CMakeFiles\opencv_python3.dir\__\src2\cv2.cpp.obj -c C:\opencv\source\opencv-4.1.0\modules\python\src2\cv2.cpp
C:\opencv\source\opencv-4.1.0\modules\python\src2\cv2.cpp:9:20: fatal error: Python.h: No such file or directory
compilation terminated.
mingw32-make.exe[2]: *** [modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.obj] Error 1
mingw32-make.exe[1]: *** [modules/python3/CMakeFiles/opencv_python3.dir/all] Error 2
mingw32-make.exe: *** [all] Error 2
modules\python3\CMakeFiles\opencv_python3.dir\build.make:62: recipe for target 'modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.obj' failed
mingw32-make.exe[2]: Leaving directory 'C:/opencv/build'
CMakeFiles\Makefile2:3512: recipe for target 'modules/python3/CMakeFiles/opencv_python3.dir/all' failed
mingw32-make.exe[1]: Leaving directory 'C:/opencv/build'
C:/opencv/build/Makefile:161: recipe for target 'all' failed
Process terminated with status 2 (0 minute(s), 37 second(s))
4 error(s), 0 warning(s) (0 minute(s), 37 second(s))
Well, I tried all i knew to let the compiler know where Python.h was, but it didn't seem to work. Let me know if you need more data.