c++ calls python program, problems encountered in environment construction

Problem 1: Cannot open the file "python37_d.lib

The solution is to copy the python37.lib in the configured python environment and rename it to python37_d.libsample

Question 2: Cannot continue to execute code because python37.dll cannot be found Problem solving

The solution is to copy the python37.dll in the configured python environment and put it in the C:\Windows\System32 pathsample

问题三:Fatal Python error: initfsencoding: unable to load the file system codec ModuleNotFoundError: No module named ‘encodings’ Current thread 0x00001080 (most recent call first)

Solution: If the environment variable is not configured, you need to configure the environment variable and the Path variable, as shown in the figure below, sample
and configure the system variables as shown in the figure belowsample

If the system variables cannot be run after configuring the system variables, it may be written too much in the cpp file

Py_SetPythonHome(L"'C:\\ProgramData\\Anaconda3\\envs\\Getphoto\\python37");

Just comment out this partsample

Guess you like

Origin blog.csdn.net/qq_45014374/article/details/131231658
Recommended