I'm trying to buil a c++ application with embedded python using pybind11 on Windows.
I've installed python 3.7, 3.8, and 3.9 none of them is PATH
now no matter what pyhon version I want to use in cmake (by setting pybind11_DIR to pybind11 folder in the python folder, it always links to python3.9.dll)
When I rename the folder where 3.9 is installed I get following error:
FindPythonLibsNew.cmake:133: error: Python config failure:
....
/Python37/Lib/site-packages/pybind11/share/cmake/pybind11/pybind11Config.cmake:250 (include)
CMakeLists.txt:131 (find_package)
Adding "-DPYBIND11_PYTHON_VERSION=3.7" or "-DPY_PYTHON_VERSION=3.7"
Does not help. So where can I tell cmake to use 3.7 and not 3.9
Got the solution myself. The python3.9 was somewhere in the cache from an earlier build. So after deleting the whole build folder and starting everything from scratch it directly worked with python3.7
pybind11 embedded python: multiple python versions, cmake cannot find correct version