在 Windows 上为 PostgreSQL 12 安装 PL/Python [英] Install PL/Python on Windows for PostgreSQL 12

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

问题描述

我一直在为一个项目开发 FHIR,我们使用 PostgreSQL 作为数据库.在阅读文档时,我开始了解 PL/Python 并决定试一试,但我无法安装 python 扩展.

I've been working on FHIR for a project and we are using PostgreSQL as a database. While reading docs, I've come to know about PL/Python and decided to give it a shot but I am unable to install the python extension.

当我运行命令 CREATE EXTENSION pypthon3u; 我收到以下错误

When I run the command CREATE EXTENSION pypthon3u; I get the following error

Could not load library "C:/Program Files/PostgreSQL/12/lib/plpython3.dll": The specified module could not be found.

我已经检查了这个 SO 答案,但它无济于事.

I've checked this SO answer but it couldn't help.

我的 PostgreSQL 版本:PostgreSQL 12.2,由 Visual C++ build 1914 编译,64 位

My PostgreSQL version: PostgreSQL 12.2, compiled by Visual C++ build 1914, 64-bit

安装的 Python 版本:3.7.7(64 位)

Installed Python version: 3.7.7 (64 Bit)

操作系统信息:Windows 10 Enterprise 版本 1909 操作系统内部版本 18363.657

OS Info: Windows 10 Enterprise Version 1909 OS Build 18363.657

对我来说,它看起来像是不正确的 Python 版本,但我正在安装 python 3.7.* 版本,根据安装目录中的 doc\installation-notes.html 中的指定编译 PostgreSQL.

For me, it looks like incorrect version of Python but I'm installing python 3.7.* version against which PostgreSQL is compiled as specified in doc\installation-notes.html inside the install directory.

任何帮助将不胜感激.

推荐答案

即使您使用 EDB 安装程序的 Stack Builder 来安装 Python,您仍然必须按照说明确保它们包含在数据库服务器将启动".我必须在系统级别执行此操作,因为我找不到为单个服务设置 PATH 的方法.

Even if you use the EDB installer's Stack Builder to install Python, you still have to follow the instructions to "ensure they are included in the PATH variable under which the database server will be started". I had to do this at the system level, as I can't find a way to set the PATH for individual services.

然后你还需要设置 PYTHONPATH,这似乎没有记录.

And then you also need to set PYTHONPATH as well, which seems to be undocumented.

所以我最终将 c:\edb\languagepack\v1\Python-3.7 添加到 PATH 并使用 c:\edb\languagepack\v1\Python-3.7\Lib 创建 PYTHONPATH.

So I ended up adding c:\edb\languagepack\v1\Python-3.7 to PATH and creating PYTHONPATH with c:\edb\languagepack\v1\Python-3.7\Lib.

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

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