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?

+2
python postgresql plpython


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'

+4


source to share


Answer at fooobar.com/questions/1889865 / ...



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

+2


source to share







All Articles
Loading...
X
Show
Funny
Dev
Pics