PYTHON-CONFIG(1)
π PYTHON-CONFIG(1) β General Commands Manual π
okay bestie, so python-config is that girl who just tells you all the build options you need for python C/C++ extensions, or for embedding the interpreter. she doesn't do much, but she does it flawlessly. β¨
πΈ 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 ] [ --configdir ] [ --help
]
β¨ DESCRIPTION β¨
so like, python-config is here to help you compile and link programs, bestie. two whole situations:
- programs that embed the Python interpreter π
- extension modules that can be loaded dynamically (at run time) into the interpreter π§
that's it. that's the job. and she eats every time. π
π OPTIONS π
--cflagsβ prints the C compiler flags. the whole fit. π₯--ldflagsβ prints the flags that should be passed to the linker. hand these to the linker and it'll know what's up.--includesβ basically--cflags's little sister, but only the-Ioptions (aka the path to the python header files). π--libsβ same energy as--ldflags, but only the-loptions (the libraries being used). π--prefixβ prints the prefix (the base directory) under which python can be found. where she lives, basically. π--exec-prefixβ prints the prefix used for executable program directories (likebin,sbin, etc). π--extension-suffixβ prints the suffix used for extension modules (and yes, including the_dmodified for debug builds). π--configdirβ prints the path to the configuration directory, the one under which theMakefile, etc. can be found). π--helpβ prints the usage message. classic. we love a helpful queen. π«Ά
π EXAMPLES π
okay so say you wanna build the singe-file c program prog against the python library, you'd do:
gcc $(python-config --cflags --ldflags) progr.cpp -o progr.cpp
and the same thing but make it a makefile moment:
CFLAGS+=$(shell python-config --cflags)
LDFLAGS+=$(shell python-config --ldflags)
all: progr
and if you wanna build a dynamically loadable python module, do this:
gcc $(python-config --cflags --ldflags) -shared -fPIC progr.cpp
-o progr.so
slay. now go build something iconic. π β¨
β SEE ALSO β
python(1)- http://docs.python.org/extending/extending.html
- /usr/share/doc/python/faq/extending.html
π AUTHORS π
this manual page was written by Johann Felix Soden <johfel@gmx.de> for the Debian project (and may be used by others). iconic of them fr fr π
and that's the whole page bestie, no cap π«Ά this little love letter topython-configwas dated November 27, 2011, and it's thePYTHON-CONFIG(1)page from the General Commands Manual. mwah. ππ
π¦ where this page comes from
- ubuntu jammy: libpython2.7-dev 2.7.18-13ubuntu1
- ubuntu jammy: libpython2.7-dev 2.7.18-13ubuntu1.5
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms