Deploying application with Python or another embedded scripting language Deploying application with Python or another embedded scripting language python python

Deploying application with Python or another embedded scripting language


Link your application to the python library (pythonXX.lib on Windows) and add the following to your main() function.

Py_NoSiteFlag = 1;  // Disable importing site.pyPy_Initialize();    // Create a python interpreter

Put the python standard library bits you need into a zip file (called pythonXX.zip) and place this and pythonXX.dll beside the executable you distribute. Have a look at PyZipFile in the the zipfile module.


The embedding process is fully documented : Embedding Python in Another Application.The documents suggests a few levels at which embedding is done, choose whatever best fits your requirements.

A simple demo of embedding Python can be found in the directory Demo/embed/ of the source distribution.

The demo is here, should be able to build from the distro.

  • Very High Level Embedding
  • Beyond Very High Level Embedding: An overview
  • Pure Embedding
  • Extending Embedded Python
  • Embedding Python in C++

From the standard library you can select the components that do not carry too much dependencies.


To extend the answer by gimel, there is nothing to stop you from shipping python.dll, using it, and setting a correct PYTHONPATH in order to use your own installation of the python standard library. They are just libraries and files, and your install process can just deal with them as such.