[Pythonmac-SIG] Confused about framework build

Bob Ippolito bob at redivi.com
Wed Feb 28 21:07:35 CET 2007


On 2/28/07, Samuel M. Smith <smithsm at samuelsmith.org> wrote:
> >
> >> For
> >> example pythonmac has pysqlite2 version 2.2.2 but MacPorts has
> >> version
> >> 2.3.3;
> >
> > Many things build just fine out of the box with setup.py build or
> > easy-install, so updating a few things shouldn't be too hard. If
> > you run
> > into issues, you'll get help here. And you may not need the latest
> > anyway.
> >
> >> can I install the more recent MacPorts version and use it with
> >> the framework build?
> >
> > No. you need to be all Framework or all MacPorts.
> >
>
> I have 4 versions of python on my system,
>
> Apples 2.3 in
> /usr/bin/python2.3
>
> Framework MacPython 2.4.4 and 2.5.0 in
> /usr/local/bin/python2.4 -> ../../../Library/Frameworks/
> Python.framework/Versions/2.4/bin/python2.4
> /usr/local/bin/python2.5 -> ../../../Library/Frameworks/
> Python.framework/Versions/2.5/bin/python2.5
> /usr/local/bin/python -> ../../../Library/Frameworks/Python.framework/
> Versions/2.5/bin/python
>
> and DarwinPorts python 2.4.3 in
> /opt/local/bin/python2.4
>
> with my execution path
> echo $PATH
> /Library/Frameworks/Python.framework/Versions/Current/bin:/usr/local/
> bin:/opt/local/bin:/bin:/sbin:/usr/bin:/usr/sbin
>
> the python I get by default when I just type python is framework 2.5
> since that directory is first in my search path
> /Library/Frameworks/Python.framework/Versions/Current/bin/python ->
> python2.5
> If I want something else I just need to be more explicit on the
> command line.
>
>  From what I can tell anything that uses python in DarwinPorts uses a
> path that executes the python in /opt/local/bin so
> pythons installed elsewhere in the system don't confuse it.
>
>
> The way I do it is use MacPorts (DarwinPorts) to use MacPorts to
> install non python libraries like sqlite
> and then manually install the python bindings using the framework
> build. Usually
> sudo python setup.py build
> sudo python setup.py install
> works for most simple modules
>
> For example I used Macports to install sqlite3 and then Python2.5 which
> has sqlite3 python bindings built in, just
>
> import sqlite3
>
> for python2.4 or python2.5 just (replace python with python2.4 or
> python2.5 if you have both installed)
>
> cd pysqlite-2.3.3
> sudo python setup.py build
> sudo python setup.py install
>
> works to get the pysqlite bindings. You can have both the sqlite3
> python bindings and the pysqlite bindings
> in 2.5 since different modules to bind to sqlite3

I'm pretty sure that the framework build of python 2.5 ships with
working pysqlite bindings out of the box and its own copy of sqlite in
the framework (probably statically linked to the bindings).

>
> For Apache2 and mod_python, I installed using MacPorts which has to
> use  python2.4.3 installed in /opt/...
> which it installs automatically as a dependency for mod_python
> This does not conflict with the framework builds in /Library/
> Frameworks/Python.framework/Versions/
> But I can't use 2.5 for web development.
>
> So if I want to use 2.5 for web development I either have to figure
> out how to install Apache2 and mod_python from source or wait until
> DarwinPorts does a python2.5 version of mod_python.

Or you could just stop using mod_python. It's not a particularly good
model for doing secure and scalable webapps and it's a bitch to
deploy. There's just no reason to embed python inside apache when you
can serve it by reverse proxy or fastcgi.

-bob


More information about the Pythonmac-SIG mailing list