PostgreSQL: how to install plpythonu extension

2020-03-01 07:07发布

I'm running PostgreSQL 9.3.1 on Ubuntu 12.04.4. I'd like to use the plpython language extension but I get an error when I try to use it:

ERROR: language "plpythonu" does not exist

When I try to create the extension:

CREATE EXTENSION plpythonu

...I get the error: ERROR: could not access file "$libdir/plpython2": No such file or directory

After much searching and digging through blog posts I've tried installing additional packages and have copied all the plpython files from /usr/share/postgresql/9.1/extension to /opt/bitnami/postgresql/share/extension where PostgreSQL seems to be looking for them. That at least got me to where PostgreSQL sees the available extensions. When I run:

select name, default_version, installed_version from pg_available_extensions where name like 'plpy*'

I get :

name | default_version | installed_version ------------+-----------------+------------------- plpython2u | 1.0 | plpython3u | 1.0 | plpythonu | 1.0 |

There are still no plpython libraries that I can see in /opt/bitnami/postgresql/lib. Can anybody help me get through remaining steps to make the extension work? Thanks in advance!

2条回答
够拽才男人
2楼-- · 2020-03-01 07:35

for postgres 11.2 (Debian based) I needed to install:

apt-get update && apt-get install postgresql-plpython3-11
查看更多
ら.Afraid
3楼-- · 2020-03-01 07:40

You're using a PostgreSQL package from Bitnami, in /opt. It's not clear if you installed this with apt-get or via an installer script/program, but in either case it's not the same PostgreSQL as what's in the Ubuntu postgresql package.

Installing postgresql-plpython won't do you any good, because you're installing PL/Python support for a different PostgreSQL install than the one you're actually using.

You'll need to use the same installation method you originally used to install the Bitnami PostgreSQL to add PL/Python support, if it's available. It might not be provided by Bitnami.

Otherwise, if you're not too attached to using Bitnami's PostgreSQL, you could use the recommended packages from http://apt.postgresql.org/ .

查看更多
登录 后发表回答