PYTHON-CONFIG(1)

πŸ“¦ version 2.7.18, in ubuntu jammy

πŸ’… 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 -I options (aka the path to the python header files). πŸŽ€
  • --libs β€” same energy as --ldflags, but only the -l options (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 (like bin, sbin, etc). πŸƒ
  • --extension-suffix β€” prints the suffix used for extension modules (and yes, including the _d modified for debug builds). πŸ”
  • --configdir β€” prints the path to the configuration directory, the one under which the Makefile, 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 ⭐


πŸ‘‘ 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 to python-config was dated November 27, 2011, and it's the PYTHON-CONFIG(1) page from the General Commands Manual. mwah. πŸ˜­πŸ’…
πŸ“¦ where this page comes from