autoconf: how to get python_libdir correctly?
Martin Franklin
mfranklin1 at gatwick.westerngeco.slb.com
Wed Dec 4 09:27:54 EST 2002
On Wed, 2002-12-04 at 13:38, Michael Hudson wrote:
> Gernot Hillier <ghillie at suse.de> writes:
>
> > Can I rely on sys.path[1] containing the system wide module directory?
>
> Maybe.
>
> > Other ideas?
>
> >>> from distutils import sysconfig
> >>> sysconfig.get_config_var("LIBDEST")
> '/usr/lib/python2.2'
>
> is my best effort.
>
You could get it from a standard module such as 'os'
>>> import os
>>> os.__file__
'/usr/local/lib/python2.2/os.pyc'
>>>
>>> os.path.split(os.__file__)[0]
'/usr/local/lib/python2.2'
>>>
Martin
More information about the Python-list
mailing list