繁体   English   中英

Python testing.postgresql 错误:initdb 需要程序“postgres”

[英]Python testing.postgresql error: The program "postgres" is needed by initdb

我们有一些使用 testing.posgresql 的 python 单元测试,但是我无法让它们在我的机器(Windows 10)上为我工作。 我收到有关 initdb 需要 postgresql 但无法在同一目录中找到它的上述错误。 我可以确认它们都在 PostgresSQL 安装的 bin 目录中,并且在该目录中尝试直接运行 initdb 时出现相同的错误。 此安装的 bin 和 lib 目录也在我的路径中,并且在运行which initdbwhich postgres时我得到了正确的位置,我尝试了一些事情,包括在具有类似问题但没有任何效果的线程中提出的所有解决方案,它适用于 macOS 和我们的 github 工作流程。 我安装了 PostgresSQL 14 并且正在使用 cygwin(尽管在 windows cmd 中运行时会出现完全相同的错误),感谢您的帮助。

Output 从 Postgres 安装的 bin 目录运行 initdb 时:

$ ./initdb -D example
The system cannot find the path specified.
child process exited with exit code 1
initdb: error: The program "postgres" is needed by initdb but was not found in the
same directory as "C:/Program Files/PostgreSQL/14/bin/initdb.exe".
Check your installation.

但是一个简单的 ls 显示 postgres.exe 确实存在:

$ ls
clusterdb.exe   icutu67.dll            libiconv-2.dll       libxslt.dll            pg_dump.exe               pg_restore.exe       psql.exe                           wxmsw313u_core_vc_x64_custom.dll
createdb.exe    icuuc67.dll            libintl-9.dll        oid2name.exe           pg_dumpall.exe            pg_rewind.exe        reindexdb.exe                      wxmsw313ud_aui_vc_x64_custom.dll
createuser.exe  initdb.exe             liblz4.dll           pg_amcheck.exe         pg_isolation_regress.exe  pg_test_fsync.exe    stackbuilder.exe                   wxmsw313ud_html_vc_x64_custom.dll
dropdb.exe      isolationtester.exe    libpgtypes.dll       pg_archivecleanup.exe  pg_isready.exe            pg_test_timing.exe   vacuumdb.exe                       wxmsw313ud_xrc_vc_x64_custom.dll
dropuser.exe    libcrypto-1_1-x64.dll  libpq.dll            pg_basebackup.exe      pg_receivewal.exe         pg_upgrade.exe       vacuumlo.exe                       zic.exe
ecpg.exe        libcurl.dll            libpq_pipeline.exe   pg_checksums.exe       pg_recvlogical.exe        pg_verifybackup.exe  wxbase313u_vc_x64_custom.dll       zlib1.dll
icudt67.dll     libcurl.lib            libssl-1_1-x64.dll   pg_config.exe          pg_regress.exe            pg_waldump.exe       wxbase313u_xml_vc_x64_custom.dll
icuin67.dll     libecpg.dll            libwinpthread-1.dll  pg_controldata.exe     pg_regress_ecpg.exe       pgbench.exe          wxbase313ud_net_vc_x64_custom.dll
icuio67.dll     libecpg_compat.dll     libxml2.dll          pg_ctl.exe             pg_resetwal.exe           postgres.exe         wxmsw313u_adv_vc_x64_custom.dll

我无法评论您的帖子:但是我一直在尝试在我的服务器上安装 PostgreSQL 14,该服务器已经在运行 PostgreSQL 12。我看到与“radEA2DE.bat”相关的相同错误。 这是我的安装日志中的相关代码块:

Called IsVistaOrNewer()...
    'winmgmts' object initialized...
    Version:10.
    MajorVersion:10
Granting full access to Administrators on (D:\pgData14)
    Executing batch file 'radEA2DE.bat'...
    processed file: D:\pgData14
Successfully processed 1 files; Failed processing 0 files

    Executing batch file 'radEA2DE.bat'...
    initdb: error: The program "postgres" was found by "C:/Program Files/PostgreSQL/14/bin/initdb.exe"
but was not the same version as initdb.
Check your installation.

Called Die(Failed to initialise the database cluster with initdb)...
Failed to initialise the database cluster with initdb

Script stderr:
 Program ended with an error exit code

Error running C:\WINDOWS\System32\cscript //NoLogo "C:\Program Files\PostgreSQL\14/installer/server/initcluster.vbs" "NT AUTHORITY\NetworkService" "postgres" "****" "C:\Users\USER\AppData\Local\Temp/postgresql_installer_3f464cf94c" "C:\Program Files\PostgreSQL\14" "D:\pgData14" 5433 "DEFAULT" 0: Program ended with an error exit code
Problem running post-install step. Installation may not complete correctly
 The database cluster initialisation failed.
Setting variable whoami from C:\WINDOWS\System32\whoami 
Script exit code: 0

我希望这有助于提供线索。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM