We are currently using NCS V2.0.0 to compile a project for an nRF9160. I need to create a build script for compiling the code. When I compile from VSCode everything works. Next I use nRF Connect for Desktop, Toolchain Manager and the down arrow next to nRF Connect SDK v2.1.0, I select Open command prompt to make sure all my environment variables are set correctly. Then I go to our code directory. In VSCode I copy the build command and run it in command prompt. The build always fails with this message:
[61/428] Generating ../../tfm/CMakeCache.txt
FAILED: tfm/CMakeCache.txt
.....
-- Found assembler: C:/ncs/toolchains/v2.1.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
-- Found Python3: C:/Python310/python.exe (found version "3.10.5") found components: Interpreter
.....
ImportError: Module use of python38.dll conflicts with this version of Python.
CMake Error at tools/CMakeLists.txt:161 (message):
File generation failed
It is pointing to an incorrect version of Python. Next I used VSCode to compile to a different directory so I can compare a working and not working build. The difference between the two that really stood out is:
build directory\tfm\CMakeCache.txt
Can you please give me advice why the Python executable is not set correctly when compiling TFM?