autoconf: how to get python_libdir correctly?

Gernot Hillier ghillie at suse.de
Wed Dec 4 10:57:34 EST 2002


<veröffentlicht & per Mail versendet>

Hi!

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.

Hmmm... Unfortunately, LIBDEST gives me a wrong value here:

>>> from distutils import sysconfig
>>> sysconfig.get_config_vars('LIBDEST')
['/usr/lib/python2.2']

But thanks to your suggestion I read the docu of distutils.sysconfig and 
found:

>>> sysconfig.get_python_lib()
'/usr/lib64/python2.2/site-packages'
>>> sysconfig.get_python_lib(0,1)
'/usr/lib64/python2.2'

What about this? Any reasons not to use this one?

BTW: Any idea why LIBDEST is wrong? I looked into pyconfig.h and it doesn't 
contain DEST or LIBDEST at all. Is it possible that python uses some 
(wrong) default in this case?

-- 
Bye,

Gernot



More information about the Python-list mailing list