Using PL / Pythonu with virtualenv

I am writing a function in postgres in python using the PL / Pythonu extension in postgres. I would like postgres to use my virutal environment (I am using virtualenv) instead of a global install. How should I do it?


source to share

2 answers

As it turns out, you need to add the path to where the libraries will be found in the PYTHONPATH environment variable in postgres. Don't forget to include your value, for example:

PYTHONPATH = 'path to libraries'



Answer at / ...

tl; dr - exec inside the plpython function will install the python interpreter for the life of the postgresql session.



All Articles