历史版本。 PostgreSQL 9.1 已结束支持。 2016-10-27. 请参阅 当前版本手册.
42.10. 环境变量 #
Python 解释器接受的一些环境变量也可以用来影响 PL/Python 的行为。它们需要在主 PostgreSQL 服务器进程的环境中设置,例如在启动脚本中。可用的环境变量取决于 Python 的版本;详情见 Python 文档。撰写本文时,假设 Python 版本足够新,下列环境变量会影响 PL/Python:
PYTHONHOMEPYTHONPATHPYTHONY2KPYTHONOPTIMIZEPYTHONDEBUGPYTHONVERBOSEPYTHONCASEOKPYTHONDONTWRITEBYTECODEPYTHONIOENCODINGPYTHONUSERBASE
(It appears to be a Python implementation detail beyond the control
of PL/Python that some of the environment variables listed on
the python man page are only effective in a
command-line interpreter and not an embedded Python interpreter.)