I simply tested my executable on a computer which hasn't Python installed and it worked.
When you link Python to your executable (no matter if dynamically or statically) your executable already gains basic Python language functionality (operators, methods, basic structures like string, list, tuple, dict, etc.) WITHOUT any other dependancy.
Then I let Python's setup.py compile a Python source distribution via python setup.py sdist --format=zip
which gave me a ZIP file I named pylib-2.6.4.zip
.
My further steps were:
char pycmd[1000]; // temporary buffer for forged Python script lines
...
Py_NoSiteFlag=1;
Py_SetProgramName(argv[0]);
Py_SetPythonHome(directoryWhereMyOwnPythonScriptsReside);
Py_InitializeEx(0);
// forge Python command to set the lookup path
// add the zipped Python distribution library to the search path as well
snprintf(
pycmd,
sizeof(pycmd),
"import sys; sys.path = ['%s/pylib-2.6.4.zip','%s']",
applicationDirectory,
directoryWhereMyOwnPythonScriptsReside
);
// ... and execute
PyRun_SimpleString(pycmd);
// now all succeeding Python import calls should be able to
// find the other modules, especially those in the zipped library
...