postgres 和 python [英] postgres and python
问题描述
在 postgres 9.2 中,我试图创建一个可以作为触发器的 python 程序.我想运行一个外部程序(本地磁盘上的一个 exe),所以我使用 python 来运行它.当我尝试创建一个像这样的简单程序时:
In postgres 9.2 I am trying to create a python program that can be a trigger. I want to run an external program (an exe on the local disk) so I am using python to run it. When I try to create a simple program like this:
CREATE FUNCTION one ()
RETURNS int
AS $$
# PL/Python function body
$$ LANGUAGE plpythonu;
我收到错误:
ERROR: language "plpythonu" does not exist
HINT: Use CREATE LANGUAGE to load the language into the database.
当我跑步时:
CREATE LANGUAGE plpythonu
我收到错误:
ERROR: could not access file "$libdir/plpython2": No such file or directory
我使用的是 Windows 7 和 python 2.5.
I am using Windows 7 and python 2.5 .
我找了很多地方,但找不到解决方案.
I have looked in many places but cannot find a solution.
有什么想法吗?
推荐答案
为了解决 plpython3 的这个问题,有必要:
To resolve this for plpython3, it was necessary to:
- 安装 Python 3.2
- 运行
CREATE LANGUAGE plpython3u
更新:我在这里写了一个更好的解释:https://stackoverflow.com/a/24218449/398670一个>
Update: I've written a much better explanation here: https://stackoverflow.com/a/24218449/398670
这篇关于postgres 和 python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!