From d263919045a6e29d197b3c35b16da3484342a335 Mon Sep 17 00:00:00 2001 From: developer-wlj Date: Thu, 3 Sep 2026 11:36:18 +0800 Subject: [PATCH] =?UTF-8?q?fix(doctor):=20=E8=A7=A3=E5=86=B3=20Windows=20F?= =?UTF-8?q?ree-Threading=E7=8E=AF=E5=A2=83=E4=B8=8B=20=E8=AF=8A=E6=96=AD?= =?UTF-8?q?=E6=9C=BA=E5=88=B6=E6=8A=A5=20DLL=20=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加 os 和 shutil 模块导入 - 在 Windows 环境下查找并添加 PostgreSQL 可执行文件目录到 DLL 搜索路径 - 使用 add_dll_directory 确保 PostgreSQL 相关库正确加载 --- app/doctor/dependencies.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/doctor/dependencies.py b/app/doctor/dependencies.py index 5def0e774..d5a28db20 100644 --- a/app/doctor/dependencies.py +++ b/app/doctor/dependencies.py @@ -1,11 +1,18 @@ """主程序运行依赖的轻量可用性探针。""" import argparse +import os +import shutil from importlib import import_module import sys import sysconfig import warnings +if os.name == "nt": + psql_exe = shutil.which("psql") + if psql_exe: + getattr(os, "add_dll_directory")(os.path.dirname(psql_exe)) + CORE_MODULES = ( "alembic",