PostgreSQL unable to create plpythonu extension

只谈情不闲聊 提交于 2020-01-24 03:02:07

问题


I'm trying to write a function in PostgreSQL on Windows with a Python script in the body and i'm running into an error message when trying to create the plpythonu extension. The command I'm running is:

CREATE EXTENSION plpythonu;

Which produces the following error message:

ERROR: could not access file "$libdir/plpython2": No such file or directory
SQL state: 58P01

I also tried running:

CREATE EXTENSION plpython3u;

which results in this error:

ERROR: could not load library "C:/Program Files (x86)/PostgreSQL/9.2/lib/plpython3.dll": The specified module could not be found.
SQL state: 58P01

The plpython3.dll file exists at this location, but apparently is missing some critical dependency. I've searched everywhere and found nothing helpful on this. I have both Python 2 and 3 installed on the machine...


回答1:


The newest (9.4 or later) binary installations from EnterpriseDB contain only plpython3u.dll. In versions 9.4 to 9.6 I had to install python 3.3 to get plpython3u run.

You can check which version of Python is needed by plpython3u.dll using Dependency Walker.




回答2:


A full answer can be found: https://postgresrocks.enterprisedb.com/t5/PostgreSQL/unable-to-install-pl-python-extension/m-p/4090 It assumes you have used stackbuilder to install the edb language pack. Do check the commands for correctness in your installation. E.g. path to postgresql data, install path of edb and python version. When you use depency walker (depends.exe), only pay attention to the pythonxx.dll. With older PG versions, this may or may not agree to the version installed by the EDB languages package. For version 10.7, version 3.4 Python is required. For windows, the later 3.4 Python versions do not appear to have a msi installer. You may have to install 3.4.4, or try to upgrade PG 10 to the latest version (10.11) first. This version requires python 3.7, so then you can use the EDB download. But the python version may already exist and be found. could not load library plpython3.dll (here on stackoverflow) was somewhat close, but did not detail the environment vars needed. the solution proposed does not require you to change env vars permanently, which is a great help when using several python installations.



来源:https://stackoverflow.com/questions/35210979/postgresql-unable-to-create-plpythonu-extension

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!