use*_*621 96 macos ruby-on-rails libpq pg postgresql-9.1
当我尝试运行bundle(bundle install)时,我总是得到
Installing pg (0.13.2) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/ryan/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** 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=/Users/ryan/.rvm/rubies/ruby-1.9.2-p290/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_config
Gem files will remain installed in /Users/ryan/.rvm/gems/ruby-1.9.2-p290/gems/pg-0.13.2 for inspection.
Results logged to /Users/ryan/.rvm/gems/ruby-1.9.2-p290/gems/pg-0.13.2/ext/gem_make.out
An error occured while installing pg (0.13.2), and Bundler cannot continue.
Make sure that `gem install pg -v '0.13.2'` succeeds before bundling.
Run Code Online (Sandbox Code Playgroud)
我使用的是Mac OS X 10.6,安装的PostgreSQL的版本是9.1.我发现问题出在libpq-dev中,我怎么能安装/修复它?
E.E*_*.33 99
如果你在Linux上运行,你可能会对我有用的东西感兴趣:
sudo apt-get install postgresql
sudo apt-get install libpq-dev
Run Code Online (Sandbox Code Playgroud)
然后
gem install pg
Run Code Online (Sandbox Code Playgroud)
然后
bundle install
Run Code Online (Sandbox Code Playgroud)
src:http://wikimatze.de/installing-postgresql-gem-under-ubuntu-and-mac
Eth*_*han 78
如您的错误日志中所述,您需要传递pg_config的路径.尝试使用以下方法安装gem:
gem install pg -- --with-pg-config= 'PATH_TO_YOUR_PG_CONFIG'
Run Code Online (Sandbox Code Playgroud)
如果您不确定pg_config的位置,并假设您使用的是Linux或Mac,则可以运行以下命令:
which pg_config
Run Code Online (Sandbox Code Playgroud)
您的pg-config可以位于不同的位置,具体取决于您安装postgres的方式.
Ari*_*Ari 56
如果您正在使用Postgress.app,那么您将需要访问其命令行工具.在终端或PATH配置文件中输入以下行:
PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"
Run Code Online (Sandbox Code Playgroud)
gem install pg现在应该工作.(这对我有用.)
注意新版本路径如下所示:
/Applications/Postgres.app/Contents/Versions/<version>/bin
Run Code Online (Sandbox Code Playgroud)
小智 21
如果你有自制软件,只需输入:
$ brew install postgresql
如果您没有,请在终端中输入以下内容:
ruby -e"$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
小智 12
搜索libpq:
brew search libpq
Run Code Online (Sandbox Code Playgroud)
应输出 libpqxx
然后尝试安装它:
brew install libpqxx
Run Code Online (Sandbox Code Playgroud)
您只需要安装libpq-dev:
sudo apt-get install libpq-dev
Run Code Online (Sandbox Code Playgroud)
然后宝石应该安装得很好.
按照安装后的说明进行操作:http://postgresapp.com/documentation/configuration-ruby.html
要安装pg gem,请确保已正确设置$ PATH(如http://postgresapp.com/documentation/cli-tools.html中所述),然后运行
sudo ARCHFLAGS="-arch x86_64" gem install pg
我强烈建议您阅读这两页.只是撇去它们,失去了我生命中的一小时.读它们,问题解决了.
| 归档时间: |
|
| 查看次数: |
80643 次 |
| 最近记录: |