[Python-Dev] Re: Why doesn't venv also install python3*-config?
On Thu, 9 Jan 2020 15:18:55 +0100 Victor Stinner wrote: > Which build command rely on python-config? Is it to cross-compile 3rd > party C extensions on the host? Hello, OP speaking here. In two cases I came across this issue. No cross-compiling involved. 1) To debug a Python C extension I wrote a standalone C test program which of course needs to find "Python.h" and libpython*.* for building. I ran into trouble when I tried to build that program in a custom compiled debugging Python environment. 2) I need to recheck this, but it was a "pip install" for a package from pypi org. Probably numpy or pandas errored out with not being able to find "Python.h". I'll try and re-check. ___ Python-Dev mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/KXHEX6UGOMPWOWQPGD7YQTAWECR4Q3KS/ Code of Conduct: http://python.org/psf/codeofconduct/
[Python-Dev] Re: Why doesn't venv also install python3*-config?
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. 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
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 -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/364Q6EZHSFN6DGUUDN3FKOMK4CDS3WJB/
Code of Conduct: http://python.org/psf/codeofconduct/
[Python-Dev] Re: Why doesn't venv also install python3*-config?
On 12.01.2020 19:20, [email protected] 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. + '-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 -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/364Q6EZHSFN6DGUUDN3FKOMK4CDS3WJB/ Code of Conduct: http://python.org/psf/codeofconduct/ -- Regards, Ivan ___ Python-Dev mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/EZ56AYUT52Y7PBV2ORHMFC7M4FNFWNE5/ Code of Conduct: http://python.org/psf/codeofconduct/
