[Pythonmac-SIG] Newbie embedding question

Bob Ippolito bob at redivi.com
Thu Sep 8 21:44:06 CEST 2005


On Sep 8, 2005, at 12:35 PM, Jeff Geraci wrote:

> I'm trying to embed the Python interpreter in a simple command-line
> application which I'm building with XCode 2.1.  Although the  
> application
> links, when I run it, I get the following error:
>
> "ZeroLink: unknown symbol '_Py_Initialize'
>
> I've Googled this and can't seem to find much information on this.   
> Does
> anyone know offhand how to satisfy this link condition?  As far as  
> I can
> tell, I am linking with the Python Foundation module.

Well, the first rule of embedding Python is that you probably  
shouldn't embed Python.  It's generally preferable to have Python on  
the outside, and then whatever else on the inside loaded by extension  
modules.  This is the most supported configuration on all platforms,  
and is the easiest to implement correctly.

That said, it sounds like you need to link to Python.framework.   
However, this is tricky because it's likely that the next version of  
Mac OS X won't ship with Python 2.3, so your app could very well  
break if you link against the system Python...  It's probably better  
to compile your own and statically link it in, but it really depends  
on what you're doing with Python.

-bob



More information about the Pythonmac-SIG mailing list