when im running C code to call python functions, there's error on Py_Initialize() The error is ImportError: No module named site. Ive tried to put Py_SetProgramName(argv[0]) but it doesnt work. The cmd call is cInterfacePython Test.py multiply 3 2 (exe is cInterfacePython)
I had to muck about a bit with the PATH env-var as well as PYTHONPATH to make things work better when embedding.
Py_SetProgramName is not important, it's mostly for internal reference etc...
So, I suggest you find where python is installed locally (this is available in the registry on Windows machines) and use setenv to set PATH and PYTHONPATH to something appropriate. That would be the python.exe directory for PATH (as in your comment above), as well setting PYTHONPATH to the dir with your own python code and related libraries that you're running from the embedding exe.
Then run Py_Initialize and see if the right thing happens. If you need to modify PYTHONPATH afterward initialization, modify sys.path using PySys_SetPath().
embedding python error on initialization