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

Paul Moore p.f.moore at gmail.com
Fri May 29 10:29:51 EDT 2015


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



More information about the Python-list mailing list