[capi-sig] Couple of Questions About Statically Linking the Interpreter

Campbell Barton ideasman42 at gmail.com
Tue Oct 20 15:02:54 CEST 2009


for python 2.x you can get away only with statically linked library,
but then you miss modules like math, struct and os
If you want these modules you can compile some of these into the
library you can build python with a modified config

-- quick howto --
edit ./Modules/Setup
uncomment "#*shared*" around line 152 and rename to "*static*" The
following modules are built into libpython2.5.a
uncomment: array, math, time, operator, itertools, cStringIO, cPickle,
zlib, _struct, _weakref, _random, binascii, collections, fcntl, spwd,
grp, select
--

Or you can bundle python25.zip with your application and include all
modules in this, however youll need zlib either compiled statically or
include the module unzipped in the dir.

Blender2.49 for example in win32 has python26.zip and zlib.pyd in the
current directory so python can extract the zip and open the
modules...

As for python 3.x, It cant even start unless it has some external modules

Unless there is some trick I dont know of, youll get this with a
static linked py3.1 and no modules...
---
 Fatal Python error: Py_Initialize: can't initialize sys standard streams
 ImportError: No module named encodings.utf_8
---

Heres some info I wrote about how to bundle python3.1 with blender.

http://wiki.blender.org/index.php/BlenderDev/Blender2.5/PythonAPI_31

On Tue, Oct 20, 2009 at 9:48 AM, Nathan Osman
<george_edison55 at hotmail.com> wrote:
> Im kind of new to the Python/C api and I had a couple q's about the interpreter.
>
> 1. If i statically link the libpython31.a library to my app are there any other files i need to include for the end users? Im using Windows, btw.
> 2. How do you get the interpreter output from the console when you are running within a gui environment? Can it be redirected?
>
> Thanks,
> George
>
> _________________________________________________________________
> New! Faster Messenger access on the new MSN homepage
> http://go.microsoft.com/?linkid=9677406
> _______________________________________________
> capi-sig mailing list
> capi-sig at python.org
> http://mail.python.org/mailman/listinfo/capi-sig
>



-- 
- Campbell


More information about the capi-sig mailing list