PYTHON-CONFIG(1)
β¨ PYTHON-CONFIG(1) β¨
okay so python-config is the manual page for the python-config tool, and it's literally the cutest helper for spitting out build options for python C/C++ extensions or embedding π π
π NAME π
python-config - output build options for python C/C++ extensions or embedding
π¦ SYNOPSIS π¦
python-config [ --prefix ] [ --exec-prefix ] [ --includes ] [ --libs ] [ --cflags ] [ --ldflags ] [ --extension-suffix ] [ --abiflags ] [ --help ]
π DESCRIPTION π
okay bestie, so python-config helps you compile and link programs that embed the Python interpreter, or extension modules that can get loaded dynamically (at run time) into the interpreter. it's giving build-helper energy and I'm obsessed πβ¨
πΈ OPTIONS πΈ
--abiflagsβ prints the the ABI flags as specified by PEP 3149. β¨--cflagsβ prints the C compiler flags. π--ldflagsβ prints the flags that should be passed to the linker. π--includesβ similar to--cflagsbut only with-Ioptions (path to python header files). π§--libsβ similar to--ldflagsbut only with-loptions (used libraries). π--prefixβ prints the prefix (base directory) under which python can be found. π--exec-prefixβ prints the prefix used for executable program directories (such asbin,sbin, etc). π--extension-suffixβ prints the extension suffix used for binary extensions. π--helpβ prints the usage message. π«Ά
π§ EXAMPLES π§
To build the singe-file c program prog against the python library, use
gcc $(python-config --cflags --ldflags) progr.cpp -o progr.cpp
The same in a makefile:
CFLAGS+=$(shell python-config --cflags)
LDFLAGS+=$(shell python-config --ldflags)
all: progr
To build a dynamically loadable python module, use
gcc $(python-config --cflags --ldflags) -shared -fPIC progr.cpp -o progr.so
π₯ SEE ALSO π₯
python (1)β the main python interpreter, obviously πhttp://docs.python.org/extending/extending.htmlβ the official extending docs π/usr/share/doc/python/faq/extending.htmlβ the local FAQ on extending, for when you're offline π
π AUTHORS π
this manual page was written by Johann Felix Soden <johfel@gmx.de> for the Debian project (and may be used by others). ily Johann π«Ά
bestie, that's the whole page!! π It was last updated November 27, 2011, and it's the PYTHON-CONFIG(1) manual, so go forth and build something iconic β¨π¦π
π¦ where this page comes from
- ubuntu jammy: libpython3.10-dev 3.10.12-1~22.04.18
- ubuntu jammy: libpython3.10-dev 3.10.4-3
- π girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms