如何在PostgreSQL 9.3 x64 Windows 7上安装PL / Python? [英] How to install PL/Python on PostgreSQL 9.3 x64 Windows 7?

查看:156
本文介绍了如何在PostgreSQL 9.3 x64 Windows 7上安装PL / Python?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在运行查询的数据库上的PostgreSQL内部安装PL / Python v2.x语言。

I have tried to install the PL/Python v2.x language inside PostgreSQL on my database running the query:

CREATE EXTENSION plpythonu;

(我从http://www.postgresql.org/docs/9.3/static/plpython.html

但是我收到此错误:

ERRO:  não pôde acessar arquivo "$libdir/plpython2": No such file or directory
********** Error **********
ERRO: não pôde acessar arquivo "$libdir/plpython2": No such file or directory
SQL state: 58P01

如何以自动化方式安装它?我需要在许多计算机上安装它。

How to install this in an automated way? I need to install it on many computers.

推荐答案

通常,此错误消息是Windows API <$ c发出的具有误导性的错误消息$ c> LoadLibrary 调用。实际含义更接近:

Typically this error message is a misleading one emitted by the Windows API LoadLibrary call. What it actually means is closer to:


加载 plpython2.dll 时出错:在 PATH

$ b $上找不到依赖项DLL python27.dll b

,但是Windows只是表现为它的 plpython2.dll 无法加载的自身。

but instead Windows just acts like it is plpython2.dll its self that could not be loaded.

您可以通过检查PostgreSQL安装的 lib 目录中的 plpython2.dll 。如果存在,但出现此错误,则表示缺少Python运行时。如果根本没有 plpython2.dll ,则您的PostgreSQL安装丢失了plpython2,这是我向包装团队提出的问题。

You can tell if this is the issue by checking the lib directory of your PostgreSQL install for a plpython2.dll. If it's there, but you get this error, then it's a missing Python runtime. If there's no plpython2.dll at all then your PostgreSQL install is missing plpython2, something I'm raising with the packaging team.

如果您有 plpython2.dll ,但不会加载,您需要安装与PostgreSQL版本匹配的Python运行时。它必须与用于编译PostgreSQL的Python主版本相同,例如如果使用Python 2.7编译PostgreSQL,Python 2.6将无法运行plpython。

If you have plpython2.dll but it won't load, you need to install the Python runtime that matches the PostgreSQL version. It must be the same Python major version as was used to compile PostgreSQL, e.g. if Python 2.7 was used to compile PostgreSQL, Python 2.6 won't work to run plpython.

如果通过安装程序自动安装了所需的运行时,那就太好了,但目前还不是。 它也没有正确记录,我将与包装团队联系 正确的安装运行时记录在安装目录下的 doc\installation-notes.html 中,也可以通过进行访问开始菜单中的PostgresSQL 9.3->文档->安装说明

It'd be nice if installing the required runtime was automated via the installer, but at present it isn't. It's also not properly documented, which I'll take up with the packaging team The correct runtime to install is now documented in doc\installation-notes.html inside the install directory, which you can also get to via PostgresSQL 9.3 -> Documentation -> Installation Notes in the Start menu.

对于在其安装说明文件中缺少此信息的较旧版本的磁盘'不确定是否需要使用什么版本的Python,您可以使用 depends.exe (依赖行者) 查看链接到的Python DLL。您也需要相同的Python体系结构-如果要安装64位PostgreSQL,则需要64位Python,等等。

For older relases that lack this information in their "installation notes" file, if you're not sure what version of Python is required you can use depends.exe (dependency walker) to see which Python DLL it's linked to. You need the same architecture of Python too - if you're installing 64-bit PostgreSQL you need 64-bit Python, etc.

PostgreSQL 9.3软件包需要Python 27。因此,可以从 http://python.org/ 下载Python 2.7(不是ActiveState,它们不一定兼容)。确保安装程序将Python添加到 PATH (运行安装程序时是一个选项)。

The PostgreSQL 9.3 packages require Python 27. So go download Python 2.7 from http://python.org/ (not ActiveState, they aren't necessarily compatible). Make sure Python is added to the PATH by the installer (it's an option when you run the installer). Then re-try after re-starting PostgreSQL.

您可以使用以下命令自动安装Python:

You can automate installation of Python with:

start /wait msiexec /i python-2.7.3.amd64.msi /qb /passive TARGETDIR=%SystemDrive%\Python27_x64 ALLUSERS=1

其中 python-2.7.3.amd64.msi 是您安装的Python二进制文件的文件名,并且您正在将64位版本安装到 C:\Python27_x64 。根据需要进行调整。

where python-2.7.3.amd64.msi is the filename of the Python binary you installed, and you're installing the 64-bit version to C:\Python27_x64. Adjust as desired.

这篇关于如何在PostgreSQL 9.3 x64 Windows 7上安装PL / Python?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆