Using c++ to call the extension generated by python in windows11, Fatal Python error: PyThreadState_Get: nocurrent thread appears

This machine does not have any python environment installed. I used the conda environment when I generated the dll. When I call it with c++, there will be problems.
IDE: visual studio 2022
conda: python = 3.6 cython = 0.29.33
use command: cython demo.pyx -3

I set the environment variable:

PYTHONPATH = conda_envs/cython/Lib;conda_envs/cython/DLLS;
conda_envs/cython/Lib/site-packages;
PATH=conda_envs/cython/

The python environment set in vs when I generate the dll:

INCLUDE = conda_envs/cython/include;
LIB = conda_envs/cython/libs;

The content of the pyx file is

cdef public int add( int str1, int str2):
    return int(str1) + int(str2)

The output is expected to be the sum of two integers. I have tried to link python36.lib when calling, but the effect is still the same. I don’t understand that my computer only has multiple python environments in conda and there is no python environment locally, but I do I have set the python path in the environment variable when generating or calling, so why is this happening

Read more here: Source link