Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Python

How to get directory of Python C library

 

 

Python python RSS feed   Index | Next | Previous | View Threaded


arve.knudsen at gmail

Nov 15, 2009, 9:56 AM

Post #1 of 9 (388 views)
Permalink
How to get directory of Python C library

Hi

I need to link against Python, is there a way to get the path to the
directory containing Python's C library (e.g., <exec-prefix>/libs on
Windows)?

Thanks,
Arve
--
http://mail.python.org/mailman/listinfo/python-list


deets at nospam

Nov 15, 2009, 11:05 AM

Post #2 of 9 (362 views)
Permalink
Re: How to get directory of Python C library [In reply to]

arve.knudsen [at] gmail schrieb:
> Hi
>
> I need to link against Python, is there a way to get the path to the
> directory containing Python's C library (e.g., <exec-prefix>/libs on
> Windows)?

Most probably from the registry somehow. In general, try & locate a
python-executable, and make it execute

python -c "import sys; print sys.prefix"

Capture that, and you're done. Depending on the OS, the libs then are
placed in e.g. <prefix>/lib.

Diez
--
http://mail.python.org/mailman/listinfo/python-list


arve.knudsen at gmail

Nov 15, 2009, 12:14 PM

Post #3 of 9 (361 views)
Permalink
Re: How to get directory of Python C library [In reply to]

On 15 Nov, 20:05, "Diez B. Roggisch" <de...@nospam.web.de> wrote:
> arve.knud...@gmail.com schrieb:
>
> > Hi
>
> > I need to link against Python, is there a way to get the path to the
> > directory containing Python's C library (e.g., <exec-prefix>/libs on
> > Windows)?
>
> Most probably from the registry somehow. In general, try & locate a
> python-executable, and make it execute
>
>   python -c "import sys; print sys.prefix"
>
> Capture that, and you're done. Depending on the OS, the libs then are
> placed in e.g. <prefix>/lib.

That doesn't solve anything, the hard part is figuring out the part
after <prefix> ..

Arve

--
http://mail.python.org/mailman/listinfo/python-list


deets at nospam

Nov 15, 2009, 12:24 PM

Post #4 of 9 (358 views)
Permalink
Re: How to get directory of Python C library [In reply to]

arve.knudsen [at] gmail schrieb:
> On 15 Nov, 20:05, "Diez B. Roggisch" <de...@nospam.web.de> wrote:
>> arve.knud...@gmail.com schrieb:
>>
>>> Hi
>>> I need to link against Python, is there a way to get the path to the
>>> directory containing Python's C library (e.g., <exec-prefix>/libs on
>>> Windows)?
>> Most probably from the registry somehow. In general, try & locate a
>> python-executable, and make it execute
>>
>> python -c "import sys; print sys.prefix"
>>
>> Capture that, and you're done. Depending on the OS, the libs then are
>> placed in e.g. <prefix>/lib.
>
> That doesn't solve anything, the hard part is figuring out the part
> after <prefix> ..

AFAIK is that only varying based on the OS. Under unix, it's

<prefix>/lib/python<version>/

You can get the platform via sys.platform.


Diez
--
http://mail.python.org/mailman/listinfo/python-list


arve.knudsen at gmail

Nov 15, 2009, 1:08 PM

Post #5 of 9 (360 views)
Permalink
Re: How to get directory of Python C library [In reply to]

On 15 Nov, 21:24, "Diez B. Roggisch" <de...@nospam.web.de> wrote:
> arve.knud...@gmail.com schrieb:
>
>
>
>
>
> > On 15 Nov, 20:05, "Diez B. Roggisch" <de...@nospam.web.de> wrote:
> >> arve.knud...@gmail.com schrieb:
>
> >>> Hi
> >>> I need to link against Python, is there a way to get the path to the
> >>> directory containing Python's C library (e.g., <exec-prefix>/libs on
> >>> Windows)?
> >> Most probably from the registry somehow. In general, try & locate a
> >> python-executable, and make it execute
>
> >>   python -c "import sys; print sys.prefix"
>
> >> Capture that, and you're done. Depending on the OS, the libs then are
> >> placed in e.g. <prefix>/lib.
>
> > That doesn't solve anything, the hard part is figuring out the part
> > after <prefix> ..
>
> AFAIK is that only varying based on the OS. Under unix, it's
>
>   <prefix>/lib/python<version>/
>
> You can get the platform via sys.platform.

Well, my point is that I should like a way to query for this
directory, just as I can query distutils.sysconfig for the include
directory and Python library (i.e., the standard Python library)
directory. It's not trivial to figure out Python's installation scheme
so long as it's not written in stone ..

Arve
--
http://mail.python.org/mailman/listinfo/python-list


deets at nospam

Nov 15, 2009, 1:11 PM

Post #6 of 9 (365 views)
Permalink
Re: How to get directory of Python C library [In reply to]

arve.knudsen [at] gmail schrieb:
> On 15 Nov, 21:24, "Diez B. Roggisch" <de...@nospam.web.de> wrote:
>> arve.knud...@gmail.com schrieb:
>>
>>
>>
>>
>>
>>> On 15 Nov, 20:05, "Diez B. Roggisch" <de...@nospam.web.de> wrote:
>>>> arve.knud...@gmail.com schrieb:
>>>>> Hi
>>>>> I need to link against Python, is there a way to get the path to the
>>>>> directory containing Python's C library (e.g., <exec-prefix>/libs on
>>>>> Windows)?
>>>> Most probably from the registry somehow. In general, try & locate a
>>>> python-executable, and make it execute
>>>> python -c "import sys; print sys.prefix"
>>>> Capture that, and you're done. Depending on the OS, the libs then are
>>>> placed in e.g. <prefix>/lib.
>>> That doesn't solve anything, the hard part is figuring out the part
>>> after <prefix> ..
>> AFAIK is that only varying based on the OS. Under unix, it's
>>
>> <prefix>/lib/python<version>/
>>
>> You can get the platform via sys.platform.
>
> Well, my point is that I should like a way to query for this
> directory, just as I can query distutils.sysconfig for the include
> directory and Python library (i.e., the standard Python library)
> directory. It's not trivial to figure out Python's installation scheme
> so long as it's not written in stone ..


Well, than how about you word your question like that? But there is no
simple function to call. So the answer to the question you asked is: no.

I showed you a way that works for current python, and consists of
stitching together a number of informations.

Diez
--
http://mail.python.org/mailman/listinfo/python-list


arve.knudsen at gmail

Nov 15, 2009, 2:50 PM

Post #7 of 9 (352 views)
Permalink
Re: How to get directory of Python C library [In reply to]

On 15 Nov, 22:11, "Diez B. Roggisch" <de...@nospam.web.de> wrote:
> arve.knud...@gmail.com schrieb:
>
>
>
>
>
> > On 15 Nov, 21:24, "Diez B. Roggisch" <de...@nospam.web.de> wrote:
> >> arve.knud...@gmail.com schrieb:
>
> >>> On 15 Nov, 20:05, "Diez B. Roggisch" <de...@nospam.web.de> wrote:
> >>>> arve.knud...@gmail.com schrieb:
> >>>>> Hi
> >>>>> I need to link against Python, is there a way to get the path to the
> >>>>> directory containing Python's C library (e.g., <exec-prefix>/libs on
> >>>>> Windows)?
> >>>> Most probably from the registry somehow. In general, try & locate a
> >>>> python-executable, and make it execute
> >>>>   python -c "import sys; print sys.prefix"
> >>>> Capture that, and you're done. Depending on the OS, the libs then are
> >>>> placed in e.g. <prefix>/lib.
> >>> That doesn't solve anything, the hard part is figuring out the part
> >>> after <prefix> ..
> >> AFAIK is that only varying based on the OS. Under unix, it's
>
> >>   <prefix>/lib/python<version>/
>
> >> You can get the platform via sys.platform.
>
> > Well, my point is that I should like a way to query for this
> > directory, just as I can query distutils.sysconfig for the include
> > directory and Python library (i.e., the standard Python library)
> > directory. It's not trivial to figure out Python's installation scheme
> > so long as it's not written in stone ..
>
> Well, than how about you word your question like that? But there is no
> simple function to call. So the answer to the question you asked is: no.
>
> I showed you a way that works for current python, and consists of
> stitching together a number of informations.
>
> Diez

My original question was pretty clear I think. And I don't have the
required information to deduce what the library path may look like on
any given platform, there really should be a standard function for
this.

Arve
--
http://mail.python.org/mailman/listinfo/python-list


deets at nospam

Nov 15, 2009, 2:59 PM

Post #8 of 9 (353 views)
Permalink
Re: How to get directory of Python C library [In reply to]

arve.knudsen [at] gmail schrieb:
> On 15 Nov, 22:11, "Diez B. Roggisch" <de...@nospam.web.de> wrote:
>> arve.knud...@gmail.com schrieb:
>>
>>
>>
>>
>>
>>> On 15 Nov, 21:24, "Diez B. Roggisch" <de...@nospam.web.de> wrote:
>>>> arve.knud...@gmail.com schrieb:
>>>>> On 15 Nov, 20:05, "Diez B. Roggisch" <de...@nospam.web.de> wrote:
>>>>>> arve.knud...@gmail.com schrieb:
>>>>>>> Hi
>>>>>>> I need to link against Python, is there a way to get the path to the
>>>>>>> directory containing Python's C library (e.g., <exec-prefix>/libs on
>>>>>>> Windows)?
>>>>>> Most probably from the registry somehow. In general, try & locate a
>>>>>> python-executable, and make it execute
>>>>>> python -c "import sys; print sys.prefix"
>>>>>> Capture that, and you're done. Depending on the OS, the libs then are
>>>>>> placed in e.g. <prefix>/lib.
>>>>> That doesn't solve anything, the hard part is figuring out the part
>>>>> after <prefix> ..
>>>> AFAIK is that only varying based on the OS. Under unix, it's
>>>> <prefix>/lib/python<version>/
>>>> You can get the platform via sys.platform.
>>> Well, my point is that I should like a way to query for this
>>> directory, just as I can query distutils.sysconfig for the include
>>> directory and Python library (i.e., the standard Python library)
>>> directory. It's not trivial to figure out Python's installation scheme
>>> so long as it's not written in stone ..
>> Well, than how about you word your question like that? But there is no
>> simple function to call. So the answer to the question you asked is: no.
>>
>> I showed you a way that works for current python, and consists of
>> stitching together a number of informations.
>>
>> Diez
>
> My original question was pretty clear I think. And I don't have the
> required information to deduce what the library path may look like on
> any given platform, there really should be a standard function for
> this.

I at least misunderstood it - which might be my fault. However, as there
is no such function. I suggest you discuss this on the devel-list -
however, anything before python2.7 is unlikely to grow such a function,
so you are stuck with the ways I described.

Diez
--
http://mail.python.org/mailman/listinfo/python-list


arve.knudsen at gmail

Nov 15, 2009, 3:23 PM

Post #9 of 9 (354 views)
Permalink
Re: How to get directory of Python C library [In reply to]

On 15 Nov, 23:59, "Diez B. Roggisch" <de...@nospam.web.de> wrote:
> arve.knud...@gmail.com schrieb:
>
>
>
>
>
> > On 15 Nov, 22:11, "Diez B. Roggisch" <de...@nospam.web.de> wrote:
> >> arve.knud...@gmail.com schrieb:
>
> >>> On 15 Nov, 21:24, "Diez B. Roggisch" <de...@nospam.web.de> wrote:
> >>>> arve.knud...@gmail.com schrieb:
> >>>>> On 15 Nov, 20:05, "Diez B. Roggisch" <de...@nospam.web.de> wrote:
> >>>>>> arve.knud...@gmail.com schrieb:
> >>>>>>> Hi
> >>>>>>> I need to link against Python, is there a way to get the path to the
> >>>>>>> directory containing Python's C library (e.g., <exec-prefix>/libs on
> >>>>>>> Windows)?
> >>>>>> Most probably from the registry somehow. In general, try & locate a
> >>>>>> python-executable, and make it execute
> >>>>>>   python -c "import sys; print sys.prefix"
> >>>>>> Capture that, and you're done. Depending on the OS, the libs then are
> >>>>>> placed in e.g. <prefix>/lib.
> >>>>> That doesn't solve anything, the hard part is figuring out the part
> >>>>> after <prefix> ..
> >>>> AFAIK is that only varying based on the OS. Under unix, it's
> >>>>   <prefix>/lib/python<version>/
> >>>> You can get the platform via sys.platform.
> >>> Well, my point is that I should like a way to query for this
> >>> directory, just as I can query distutils.sysconfig for the include
> >>> directory and Python library (i.e., the standard Python library)
> >>> directory. It's not trivial to figure out Python's installation scheme
> >>> so long as it's not written in stone ..
> >> Well, than how about you word your question like that? But there is no
> >> simple function to call. So the answer to the question you asked is: no.
>
> >> I showed you a way that works for current python, and consists of
> >> stitching together a number of informations.
>
> >> Diez
>
> > My original question was pretty clear I think. And I don't have the
> > required information to deduce what the library path may look like on
> > any given platform, there really should be a standard function for
> > this.
>
> I at least misunderstood it - which might be my fault. However, as there
> is no such function. I suggest you discuss this on the devel-list -
> however, anything before python2.7 is unlikely to grow such a function,
> so you are stuck with the ways I described.
>
> Diez

OK, thanks. Perhaps I'll try distutils-sig, given that it looks
natural to extend distutils.sysconfig.

Arve
--
http://mail.python.org/mailman/listinfo/python-list

Python python RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.