On 12.01.2020 19:20, mus...@posteo.org wrote:
Hi guys,
after I got the whole list into a lather about the merits of
the python-config program, let me rephrase the question:
Is there a "canonical" way of automatically finding the correct
include files and Python runtime library when embedding the Python
interpreter, based on the current virtual environment (and not the
"installed" version)? Upon reding the docs there isn't.
<full path to python executable> + '-config'
Is what
https://docs.python.org/3/extending/embedding.html#compiling-and-linking-under-unix-like-systems
seems to be suggesting to me.
This is not applicable to Windows
And maybe there
should't or cant be any. So if I want to try embedding Python under
different versions I have to either install those into different
directories and use python-config, or I write a trivial Python program
that finds the correct values for the current environment using
sysconfig and outpus those as compiler / linker flags. Easy enough, I
was just surprised that no such solution was already built into the
virtualenv setup mechanism
Virtualenv does create `python-config` shim in Linux.
Here's a quote from the docs
"""
If this procedure [using python-config] doesn’t work for you (it is not
guaranteed to work for all Unix-like platforms; however, we welcome bug
reports) you will have to read your system’s documentation about
dynamic linking and/or examine Python’s Makefile (use
sysconfig.get_makefile_filename() to find its location) and compilation
options. In this case, the sysconfig module is a useful tool to
programmatically extract the configuration values that you will want to
combine together. For example:
import sysconfig
sysconfig.get_config_var('LIBS')
'-lpthread -ldl -lutil'
sysconfig.get_config_var('LINKFORSHARED')
'-Xlinker -export-dynamic'
"""
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/python-dev@python.org/message/364Q6EZHSFN6DGUUDN3FKOMK4CDS3WJB/
Code of Conduct: http://python.org/psf/codeofconduct/
--
Regards,
Ivan
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/python-dev@python.org/message/EZ56AYUT52Y7PBV2ORHMFC7M4FNFWNE5/
Code of Conduct: http://python.org/psf/codeofconduct/