2

Ubuntu 14.04.3, PostgreSQL 9.6

Maybe I can get the plpythonu source code from the PostgreSQL 9.6 source code or somewhere else, put it into the /contrib directory, make it and CREATE EXTENSION after that!? Or something like that. Don't want to think that PostgreSQL reinstall is my only way.

Pavel Ganin
  • 21
  • 1
  • 2
  • Yes, there is. It is necessary first to create an environment variable PYTHON='path/to/python'. Then go to postgres source directory and execute `sudo make distclean`. After that compile Postgres again with parameter “--with-python”, go to `./contrib` and execute `sudo make install`. And finally, execute `CREATE EXTENSION plpython3u;` in `psql`. – Pavel Ganin May 18 '17 at 16:58

1 Answers1

2

you can simply run

python 2

sudo apt-get install postgresql-contrib postgresql-plpython-9.6

python 3

sudo apt-get install postgresql-contrib postgresql-plpython3-9.6

Then check the extension is installed

SELECT * FROM pg_available_extensions WHERE name like '%plpython%';

To apply the extension to the database, use

for python 2

CREATE EXTENSION plpython2u;

for python 3

CREATE EXTENSION plpython3u;

xuan
  • 270
  • 1
  • 2
  • 15