Distributing Python environment

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Mon Sep 14 04:30:35 EDT 2009


En Sun, 13 Sep 2009 08:32:33 -0300, Ecir Hana <ecir.hana at gmail.com>  
escribió:

> I have an app which I would like to extend with Python. I I saw how to
> embed the interpreter into C. If I bundle my app with the Python lib
> (say, python26.dll) I can PyRun_SimpleString() some code. My question
> is, how do I bundle the rest of the libraries (site, os, elementtree,
> random, ...)? Is it possible to make one huge (ok, not so huge) .zip
> blob containing all of the libraries?

Yes. That's what py2exe, cx_freeze and others do.
If you put a .zip file name in sys.path, it is searched as it were a  
directory.

> And what happens if some user
> has Python already installed? Which libraries get loaded first? Is it
> possible to alter this order? I mean, first check for local Python
> install and if the user doesn't have Python installation use the
> bundled one?

Nothing special. Python looks for modules along its search path  
(sys.path); whatever is found first, wins.

-- 
Gabriel Genellina




More information about the Python-list mailing list