I have a postgres 11 database running on CentOS 7 and am trying to use PL/python, but need to point to a specific version of the python interpreter. I need to use python3.9 whereas it is using python3.6. I am not able to uninstall python3.6 at the moment, so was hoping to point plpython3 at my python3.9 interpreter somehow.
I have installed the package postgresql-plpython3:
sudo yum install -y postgresql-plpython3
I have created an extension in PG and can run a simple PL/python function that reports the version used:
CREATE OR REPLACE FUNCTION pyver ()
RETURNS TEXT
AS $$
import sys
pyversion = sys.version
return pyversion
$$ LANGUAGE 'plpython3u';
Executing it returns this:
# select pyver();
pyver
-----------------------------------------
3.6.8 (default, Nov 16 2020, 16:55:22) +
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
(1 row)
On my operating systems I have the following python interpreter files, and the versions they are using:
$ /usr/bin/python3 --version
Python 3.9.6
$ python3 --version
Python 3.9.6
$ python3.6 --version
Python 3.6.8
Something within the plpython3 module seems to be hard-coded to point to my python3.6 version.