Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #91458 > unrolled thread

Is it possible to find python34.lib from within Python?

Started byPaul Moore <p.f.moore@gmail.com>
First post2015-05-29 07:29 -0700
Last post2015-05-29 09:19 -0700
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  Is it possible to find python34.lib from within Python? Paul  Moore <p.f.moore@gmail.com> - 2015-05-29 07:29 -0700
    Re: Is it possible to find python34.lib from within Python? Ned Deily <nad@acm.org> - 2015-05-29 09:19 -0700

#91458 — Is it possible to find python34.lib from within Python?

FromPaul Moore <p.f.moore@gmail.com>
Date2015-05-29 07:29 -0700
SubjectIs it possible to find python34.lib from within Python?
Message-ID<68710660-0f24-403a-8c3d-996c06a26a35@googlegroups.com>
I want to set up a script to build some C code. I need to link it with python34.lib, but I'm not sure how to locate that file without hard-coding it.

There doesn't seem to be a sysconfig path I can use - best ways I can think of for finding it in a way that works even if I'm in a virtualenv is:

os.path.join(getattr(sys, 'real_prefix', sys.prefix), 'libs', 'python%s%s.lib' % sys.version_info[:2])

Is that the best way, or is there something better I could use?

In particular, this only works on Windows, which is OK for my needs, but it'd be nice if I could make it cross-platform, just in case.

Paul

[toc] | [next] | [standalone]


#91472

FromNed Deily <nad@acm.org>
Date2015-05-29 09:19 -0700
Message-ID<mailman.194.1432916402.5151.python-list@python.org>
In reply to#91458
In article <68710660-0f24-403a-8c3d-996c06a26a35@googlegroups.com>,
 Paul  Moore <p.f.moore@gmail.com> wrote:
> I want to set up a script to build some C code. I need to link it with 
> python34.lib, but I'm not sure how to locate that file without hard-coding 
> it.
[...]

If you are embedding Python, refer to the "Extending and Embedding" 
document in the Python documentation set and the description of 
python-config:

https://docs.python.org/3/extending/embedding.html#compiling-and-linking-
under-unix-like-systems

(Of course, if you are extending Python, Distutils should provide all 
the necessary flags.)

-- 
 Ned Deily,
 nad@acm.org

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web