簡體   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