The easiest way to get started with PostgreSQL on the Mac


PL/Python allows you to create stored procedures and functions in Python.

PL/Python is an untrusted language. This means that only a superuser can create procedures with it, but other users can use them. The default user created by is a superuser, so this shouldn’t be an issue in most cases.

To use PL/Python with, you first need to install Python using the installers from

Unfortunately, PostgreSQL can only link with a specific version of Python. Please install the correct version of Python, depending on the PostgreSQL version you are using:

PostgreSQL Version Python Version
PostgreSQL 16 Python 3.12.x from
PostgreSQL 15 Python 3.11.x from
PostgreSQL 14 Python 3.9.x from
PostgreSQL 13 Python 3.8.x from
PostgreSQL 12 and earlier Python 2.7 (included with macOS)

Make sure to install the correct version of Python, then use the SQL command CREATE EXTENSION plpython3u; to enable the extension.