• Advertisement
Sign in to follow this  

Distributing C++ App with Python

This topic is 1987 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts


I have written an application C++ that compiles on Windows and Linux. Now I have also written some .py Python Scripts that shall be shipped with my application.

My questions:
1) If I want to call a function from one of my Python scripts from C++ all I have to do is to do include <Python.h> and link against libPython.so (on Linux) and python27.lib on Windows. Anything else I have to do?

2) There is one thing about Python on Windows I don't understand. I have installed Python 2.7 on my Windows Machine and in the installed directory there is an "include", "libs" and "DLLs" directory. In the "libs" directory is a python27.lib and I guess I have to link against that one. But why is there no python27.dll in the DLLs directory?
I guess this .lib is an import lib, so there HAS to be a corresponding .dll, but I can't find it. Anyone knows where the python dll is?

3) If I want to ship my C++ application (that calls python code) along with the .py files: All I need to add into my distribution is the python .dll/.so and the python interpreter? Anything else I need?

Thanks for any help!

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement