September 26, 2024: PostgreSQL 17 Released!
Unsupported versions: 7.2
This documentation is for an unsupported version of PostgreSQL.
You may want to view the same page for the current version, or one of the other supported versions listed above instead.

26.2. Installation

To build PL/Python, the --with-python option needs to be specified when running configure. If after building and installing you have a file called plpython.so (possibly a different extension), then everything went well. Otherwise you should have seen a notice like this flying by:

*** Cannot build PL/Python because libpython is not a shared library.
*** You might have to rebuild your Python installation.  Refer to
*** the documentation for details.

That means you have to rebuild (part of) your Python installation to supply this shared library.

The catch is that the Python distribution or the Python maintainers do not provide any direct way to do this. The closest thing we can offer you is the information in Python FAQ 3.30. On some operating systems you don't really have to build a shared library, but then you will have to convince the PostgreSQL build system of this. Consult the Makefile in the src/pl/plpython directory for details.