亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

在嘗試安裝pg gem時找不到‘libpq-fe.h標頭

在嘗試安裝pg gem時找不到‘libpq-fe.h標頭

HUH函數 2019-07-02 15:29:24
在嘗試安裝pg gem時找不到‘libpq-fe.h標頭我正在使用RubyonRails 3.1預版本。我喜歡使用PostgreSQL,但問題是安裝pg寶石。它給出了以下錯誤:$ gem install pgBuilding native extensions.  This could take a while...ERROR:  Error installing pg:    ERROR: Failed to build gem native extension.        /home/u/.rvm/rubies/ruby-1.9.2-p0/bin/ruby extconf.rbchecking for pg_config... noNo pg_config... trying anyway. If building fails, please try again with --with-pg-config=/path/to/pg_configchecking for libpq-fe.h... noCan't find the 'libpq-fe.h header*** extconf.rb failed ***Could not create Makefile due to some reason, probably lack ofnecessary libraries and/or headers.  Check the mkmf.log file for moredetails.  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=/home/u/.rvm/rubies/ruby-1.9.2-p0/bin/ruby    --with-pg    --without-pg    --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-pg-config    --without-pg-config    --with-pg_config    --without-pg_configGem files will remain installed in /home/u/.rvm/gems/ruby-1.9.2-p0/gems/pg-0.11.0 for inspection.Results logged to /home/u/.rvm/gems/ruby-1.9.2-p0/gems/pg-0.11.0/ext/gem_make.out我該如何解決這個問題?
查看完整描述

3 回答

?
瀟湘沐

TA貢獻1816條經驗 獲得超6個贊

在……上面MacOS(以前MacOSXOSX)、使用自制若要安裝適當的標題,請執行以下操作:

brew install postgresql

然后跑

gem install pg

應該行得通。

或者,而不是安裝整個postgresql,你可以brew install libpq并輸出正確的PATHPKG_CONFIG_PATH如“注意事項”一節所述


查看完整回答
反對 回復 2019-07-02
?
富國滬深

TA貢獻1790條經驗 獲得超9個贊

我也試過gem install libpq-dev,但我收到了以下錯誤:

Can't find the 'libpq-fe.h header*** extconf.rb failed ***

但是我發現sudo apt-get(我試圖避免與RubyonRails一起使用)成功了,即

sudo apt-get install libpq-dev# orapt-get install postgres-server-dev-{pg.version}# for postgresql 9.4 on Ubuntu 14.04

然后我就能做到

gem install pg

沒有問題。


查看完整回答
反對 回復 2019-07-02
  • 3 回答
  • 0 關注
  • 1115 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號