How to embed the binarized python package in C++ proejct

  binaries, c++, python, python-embedding

I have the Python Project and C++ Project.
Python package will be used in C++ project by using python.lib like below code

Py_Initialize();

auto modulePath = ".";
PyObject* sysPath = PySys_GetObject("path");
PyList_Append(sysPath, PyUnicode_FromString(modulePath));

wchar_t* pypath = NULL;
pypath = Py_GetPath();

PyObject* pmod = PyImport_ImportModule("PackageName.ModuleName");
PyObject* pclass = PyObject_GetAttrString(pmod, "ClassName");

But, Python script files (.py) should be included in the c++ project.
I don’t want the code to be disclosed when distributing.

Is there any way to binaries the python script and embedding it to C++ project??

Source: Windows Questions C++

LEAVE A COMMENT