Sign in to follow this  
SpacedOut

If I embed Python into C++, will any comp I run the program on need python installed?

Recommended Posts

Guest Anonymous Poster
Quote:
Original post by SpacedOut
I've seen plenty on code to embed Python, but not much on how to link libraries, and build


Depends on how exactly you do embed the python interpreter: usually, you will simply want to link to the libraries dynamically, this would require python (the libs that is) to be installed on any system running your app, as well.
Alternatively, you can provide your binary linked statically to the python interpreter, that way the whole thing would be self-contained and would not require any separate python libs.



Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster

Depends on how exactly you do embed the python interpreter: usually, you will simply want to link to the libraries dynamically, this would require python (the libs that is) to be installed on any system running your app, as well.
Alternatively, you can provide your binary linked statically to the python interpreter, that way the whole thing would be self-contained and would not require any separate python libs.

This is quite inexact.
The Python interpreter is a rather small shared library (e.g. python24.dll), usually installed to global library directories (e.g. c:\windows\system32); the executables and scripts installed to the Python directory are irrelevant for embedding. applications link to this dynamic library and if it is redistributed with the application (in its private directory) existing Python installations won't be involved.
Python libraries can be bundled with the application in a similar way, excluding unneeded ones and possibly replacing them with customized versions.

Share this post


Link to post
Share on other sites
so if I linked python24.dll with my C++ program and compiled it, then distributed the program with the library in the proper directory, that would be all I need to do?

Share this post


Link to post
Share on other sites
Quote:
Original post by SpacedOut
so if I linked python24.dll with my C++ program and compiled it, then distributed the program with the library in the proper directory, that would be all I need to do?


Yes.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
That's true as long as you don't use any script from the Python distribution.

It means you will have to distribute those files. You can choose to install the whole lib ( Lib + libs directories ), or only those you are interested in.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this