We now have a small library that lets us quickly and easily embed Python into our own C++ application. It's not quite production-ready, and it's certainly nowhere near complete in terms of access to the underlying Python API, but it's a good starting point to build upon.
The last thing we need to look at is what you need to distribute for your program to work. While you'd think your program's EXE and the Python DLL would be enoughOf course, as with any other program compiled with VS2012, you will need to have the VS2012 runtime installed., it's not quite. If we transfer these files to another computer and try to run it, we get the same ImportError: No module named site error we encountered in this tutorial.
We temporarily hacked around this by setting the PYTHONPATH environment variable to point to the library files, but for a proper distribution, we will need to include the Python library files, and tell our own app where to find them.
Python looks for its library in several places, but easiest way to distribute the files is to create a ZIP file with the same base name as the Python DLL (e.g. python27.zip) and put all the .py files in the Python Lib/ sub-directory You'll find this under wherever you unpacked the Python source code files. into it You will also need the encodings/ sub-directory..