
On 24.02.2013 13:25, ecir hana wrote:
Hello,
I would like to embed Python 3.3, I followed the simplest tutorial here: http://docs.python.org/3.3/extending/embedding.html
I'm on MacOS 10.8 which has Python 2.7 but I would like to embed the 3.3 version. I downloaded v3.3 binary distribution from python.org for Mac. I unzipped the archive, took out all the headers and "Python" dynamic library to a new folder. I then renamed the "Python" file to "python33" so that it wont collide with installed Python 2.7. So in the folder, there are:
embed.c include (folder) python33
Running "file python33" says:
python33 (for architecture i386): Mach-O dynamically linked shared
library i386 python33 (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
Something is wrong here: the library is usually called something like "libpython3.3m.a".
and embed.c is:
#include <Python.h> int main(int argc, char *argv[]) { Py_Initialize(); PyRun_SimpleString("print 'test'\n"); Py_Finalize(); return 0; }
It compiles but when I do "gcc embed.c -I./include -L. -lpython33" it breaks with:
ld: library not found for -lpython33
This would have to be -lpython3.3m or similar.
Please, does anyone know how to make it compile? I don't want to *install* Python 3.3 - is it possible to just extract the dynamic library from the binary distribution and use it, like I did above? I also tried:
DYLD_LIBRARY_PATH="." gcc embed.c -I./include -L. -lpython33
but it doesn't work.
Please make sure that you actually have the correct library in your current directory.
-- Marc-Andre Lemburg eGenix.com
Professional Python Services directly from the Source (#1, Feb 24 2013)
Python Projects, Consulting and Support ... http://www.egenix.com/ mxODBC.Zope/Plone.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
::::: Try our mxODBC.Connect Python Database Interface for free ! ::::::
eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/

On Sun, Feb 24, 2013 at 2:30 PM, M.-A. Lemburg <mal@egenix.com> wrote:
Something is wrong here: the library is usually called something like "libpython3.3m.a".
There was "libpython3.3.dylib" which is a symlink to "Python" which I renamed to "python33" so it does not collide with installed "Python" v2.7. I also tried "python33.dylib", "libpython33", "libpython33.dylib", "libpython33.so" to no avail...
Btw, why ".a"? I thought that for static linking. The binary distribution from python.org only contains some dylibs...
Please make sure that you actually have the correct library in
your current directory.
I think I have - it just those 3 files from above in the directory.
participants (2)
-
ecir hana
-
M.-A. Lemburg