如何为postgres安装plpython



我有postgres图像:https://hub.docker.com/_/postgres我正试图用以下命令创建python扩展:

create extension plpythonu

但它失败了,错误是:

psql:/docker-entrypoint-initdb.d/init.sql:1: ERROR:  could not open extension control file "/usr/share/postgresql/12/extension/plpythonu.control": No such file or directory

在我的Dockerfile中,我尝试安装包:

FROM postgres
RUN apt-get update -y
RUN apt install postgresql-plpython3-12

我得到错误:


Unable to locate package postgresql-plpython3-12

如何扩展postgresql以便使用python?

我找到了一个将plpython3安装到我的postgres容器中的解决方案

FROM postgres
RUN apt-get update
RUN apt-get -y install python3 postgresql-plpython3-12
COPY pg-setup-scripts/init.sql /docker-entrypoint-initdb.d

然后在入口点脚本中


create extension plpython3u;

最新更新