PostgreSql+ Python+ Windows 10

发布于 2025-02-13 12:29:06 字数 638 浏览 0 评论 0原文

在Postgres中,我尝试使用语言plpython3u执行任何查询,就像:

    CREATE OR REPLACE FUNCTION func(
    file_name character varying)
  RETURNS text AS
$BODY$
  return "aa"
$BODY$
  LANGUAGE plpython3u VOLATILE
  COST 100;

之后,服务器崩溃了以下错误:

该应用程序丢失了数据库连接:⁃如果连接空闲,则可能已被强行断开连接。 ⁃应用程序服务器或数据库服务器可能已重新启动。 ⁃用户会话可能已经计时了。您想继续建立新的会议吗?

我在Postgres日志中查看以下错误:

致命的Python错误:Initfsencoding:无法加载文件系统codec modulenotfoundError:no no模块名为“编码”当前线程0x00001E44(最新呼叫首先):2022-07-07-06 21:25 21:25 21:25 :06.113 msk [6000] chomk (PID 3592)可以

搜索主题上的主题,确实创建了扩展名plpython3u; 并设置环境变量,但没有任何改变。 我不明白问题是什么,安装了Python 3.7(根据Postgres11文档)

In Postgres I try to execute any query with LANGUAGE plpython3u like:

    CREATE OR REPLACE FUNCTION func(
    file_name character varying)
  RETURNS text AS
$BODY$
  return "aa"
$BODY$
  LANGUAGE plpython3u VOLATILE
  COST 100;

after that the server crashes with the following error:

The application has lost the database connection: ⁃ If the connection was idle it may have been forcibly disconnected. ⁃ The application server or database server may have been restarted. ⁃ The user session may have timed out. Do you want to continue and establish a new session?

I looked in the Postgres logs for the following error:

Fatal Python error: initfsencoding: unable to load the file system codec ModuleNotFoundError: No module named 'encodings' Current thread 0x00001e44 (most recent call first): 2022-07-06 21:25:06.113 MSK [6000] СООБЩЕНИЕ: процесс сервера (PID 3592) был прерван исключением 0xC0000409

Googled on topics, did CREATE EXTENSION plpython3u;
and set up environment variables, but nothing changes.
I don’t understand what the problem is, Python 3.7 is installed (according to Postgres11 documentation)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文