How to install 3rd party module for postgres pl/python?

后端 未结 3 1568
谎友^
谎友^ 2020-12-30 00:47

I need to import a 3rd party module inside my pl/python function. It seems pl/python uses an internal python that does not have any 3rd party modules.

I get this kin

3条回答
  •  北海茫月
    2020-12-30 01:24

    pl/python has access to the all the modules that the normal Python interpreter would have as long as they are in the $PYTHONPATH on the server (and the user that runs the postgres service). Does import lucene work if you run it in the Python interpreter on the server?

    If your module is installed somewhere else (e.g. not dist-packages etc.), then you would need to edit your /etc/postgresql/9.1/main/environment (adjust to your PostgreSQL version) file on the server and add something like PYTHONPATH=''.

提交回复
热议问题