【问题标题】:how to install plpython for postgres?如何为 postgres 安装 plpython?
【发布时间】:2020-09-24 11:03:43
【问题描述】:

我有 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 ?

【问题讨论】:

  • 什么版本的Debian?仅供参考,create extension plpythonu 将安装 Python 2 版本。如果你想要 Python 3 版本,你需要create extension plpython3u

标签: postgresql docker debian


【解决方案1】:

我找到了将 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;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-09-19
    • 1970-01-01
    • 1970-01-01
    • 2011-04-28
    • 2011-11-03
    • 1970-01-01
    • 2011-12-23
    相关资源
    最近更新 更多