PYTHON-CONFIG(1)

πŸ“¦ version 3.15.0, in ubuntu stonking

πŸ’– PYTHON-CONFIG(1) πŸ’–

okay bestie, welcome to the General Commands Manual page for python-config β€” yes that's the manual name right there, we're not doing a boring header line, we're doing ✨vibes✨.


🌸 NAME 🌸

python-config β€” spits out the build options you need for python C/C++ extensions, or for embedding, no cap πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

python-config [ --prefix ] [ --exec-prefix ] [ --includes ] [ --libs ] [
--cflags ] [ --ldflags ] [ --extension-suffix ] [ --abiflags ] [ --help
]

πŸ¦‹ DESCRIPTION πŸ¦‹

so like. python-config is the girl who helps you compile and link your programs πŸ”₯ β€” the ones that embed the Python interpreter, or the extension modules that get loaded dynamically (like, at run time, bestie) into the interpreter. she's got you 🫢


✨ OPTIONS ✨

  • --abiflags β€” prints the ABI flags, as specified by PEP 3149. (the original totally says "the the", we're not judging, we're just printing the ABI flags πŸ’–)
  • --cflags β€” prints the C compiler flags.
  • --ldflags β€” prints the flags you should be passing to the linker.
  • --includes β€” basically --cflags's little sister, except it only gives you the -I options (that's the path to the python header files πŸ“).
  • --libs β€” same energy as --ldflags, except it only gives you the -l options (the libraries being used).
  • --prefix β€” prints the prefix (the base directory) that python lives under 🏠.
  • --exec-prefix β€” prints the prefix used for executable program directories (think bin, sbin, etc.).
  • --extension-suffix β€” prints the extension suffix used for binary extensions.
  • --help β€” prints the usage message. classic.

🌈 EXAMPLES 🌈

πŸ“ building a single-file c program

say you wanna build the single-file c program prog against the python library β€” use:

gcc $(python-config --cflags --ldflags) progr.cpp -o progr.cpp

🧚 same thing but in a makefile

CFLAGS+=$(shell python-config --cflags)
LDFLAGS+=$(shell python-config --ldflags)
all: progr

πŸ’œ building a dynamically loadable python module

gcc $(python-config --cflags --ldflags) -shared -fPIC progr.cpp
-o progr.so

πŸ‘‘ SEE ALSO πŸ‘‘


πŸ’€ AUTHORS πŸ’€

this manual page was written by Johann Felix Soden <johfel@gmx.de> for the Debian project (and yes, it may be used by others, slay 🫢).


fr fr that's the whole page, nothing skipped, every flag accounted for πŸ’…

so yeah, that's the General Commands Manual version β€” November 27, 2011, babes, and it's giving iconic. periodt. βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from