Take 2: Building cv2_xxx.pyd for Windows x64/Python3.7

asked 2020-01-19 07:24:11 -0500

g40 gravatar image

updated 2020-01-19 11:32:45 -0500

I've tried to simplify replicating this issue by using the command line version of cmake and the configuration script that can be found here. It is about as simple as possible. There are no obvious errors/warnings from CMake but python3 support remains unavailable. Any help welcomed. How do the CI builds for this environment get configured and build?


configure script: https://raw.githubusercontent.com/g40/images/master/cfg.cmd

configuration log: https://raw.githubusercontent.com/g40/images/master/config.log

[edit] This is now working for VS2019x64 and Python 3.7 for release builds.

edit retag flag offensive close merge delete


  • can i ask you to clean your build folder and start all over with cmake ? there are some interesting parts missing in your output, probably because it used cached vars from a prev. run

  • -D PYTHON3_LIBRARY="%PYROOT%/libs/python37.lib"-D -- missing blank here

berak gravatar imageberak ( 2020-01-19 07:54:10 -0500 )edit

what is -G -A x64 " ?

LBerger gravatar imageLBerger ( 2020-01-19 08:06:20 -0500 )edit

@berak. the script nukes ./build every time it is invoked. extra. is there another cache folder? space before -D added to no effect. :\\ ah. you mean the.cache folder?

g40 gravatar imageg40 ( 2020-01-19 08:35:11 -0500 )edit

@LBerger -G specifiies generator (VS2019 in this case) -A is architecture. x64 here.

g40 gravatar imageg40 ( 2020-01-19 08:36:03 -0500 )edit

and what's about the " ? it seems to be alone

LBerger gravatar imageLBerger ( 2020-01-19 08:37:20 -0500 )edit

I think I've now got a configuration that includes Python3 (details to follow) but now the VS2019 install step fails with

4>CMake Error at modules/python3/cmake_install.cmake:93 (file):
4>  file INSTALL cannot find
4>  "R:/src/libs/opencv/build/lib/python3/Release/cv2.so": File exists.
4>Call Stack (most recent call first):
4>  modules/cmake_install.cmake:84 (include)
4>  cmake_install.cmake:126 (include)

FWIW the python3 folder is emply. No .dll and no .so (why .so on Windows?)

g40 gravatar imageg40 ( 2020-01-19 10:19:33 -0500 )edit

Did you build something using vs2019 ? it takes 10 minutes to build opencv

LBerger gravatar imageLBerger ( 2020-01-19 11:24:30 -0500 )edit