簡體   English   中英

無法在Windows中安裝pg gem

[英]Unable to install pg gem in windows

在Windows中安裝pg gem時出現以下錯誤。 使用的命令: $ gem install pg--with-pg = S:

****輸出:****

Building native extensions with: '-- with-pg=S:'
This could take a while...
ERROR:  Error installing pg:
        ERROR: Failed to build gem native extension.

    c:/RailsInstaller/Ruby2.1.0/bin/ruby.exe extconf.rb -- with-pg=S:
checking for pg_config... yes
Using config values from S:/bin/pg_config.exe
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=c:/RailsInstaller/Ruby2.1.0/bin/ruby
        --with-pg
        --enable-windows-cross
        --disable-windows-cross
        --with-pg-config
        --without-pg-config
        --with-pg_config
        --without-pg_config
        --with-pg-dir
        --without-pg-dir
        --with-pg-include
        --without-pg-include=${pg-dir}/include
        --with-pg-lib
        --without-pg-lib=${pg-dir}/lib
        --with-pqlib
        --without-pqlib
        --with-libpqlib
        --without-libpqlib
        --with-ms/libpqlib
        --without-ms/libpqlib

extconf failed, exit code 1

Gem files will remain installed in c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1
.0/gems/pg-0.18.4 for inspection.
Results logged to c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/extensions/x86
-mingw32/2.1.0/pg-0.18.4/gem_make.out

通過谷歌搜索,我發現我們應該安裝“ apt-get install libpq-dev”。 誰能告訴我如何在Windows計算機上執行此操作。

如果我嘗試“ gem install libpq-dev”,我將得到以下錯誤。

錯誤:在任何存儲庫中找不到有效的gem'libpq-dev'(> = 0)錯誤:可能的替代品:libevdev,libpixel

誰能告訴我如何在Windows計算機上執行此操作。

Windows對庫的對待與Linux / Mac ; 沒有像apt-getbrew那樣的存儲庫(盡管chocolatey正在興起)...您必須自己下載這些庫並直接引用它們...

Download the PGSQL binary: http://www.enterprisedb.com/products-services-training/pgbindownload

gem install pg -- --with-pg-dir="C:\Path\To\PostgreSQL\9.5"

很好的資源

試試這個會起作用

sudo apt-get install -y libpq-dev build-essential postgresql-server-dev-all libpgsql-ruby postgresql ruby-dev && gem install pg

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM