我已经完成了将数据库更改为Postgresql的所有操作。
1)我尝试从自制程序中卸载并安装 2)我已尝试从www.postgresql.org安装postgresql
但是他们两个都没有工作......当我尝试安装" gem pg"
时我遇到了同样的错误 $bundle install
.
.
Installing pg 0.17.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /private/var/folders/jd/dn7zyf593n97j1rdjbbh_hl00000gn/T/bundler20151201-657-1v67eg6pg-0.17.1/gems/pg-0.17.1/ext
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20151201-657-kkjx98.rb extconf.rb --with-pg config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config
Using config values from /Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config
sh: /Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config: No such file or directory
sh: /Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config: No such file or directory
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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
--with-pg
--without-pg
--with-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}/
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/var/folders/jd/dn7zyf593n97j1rdjbbh_hl00000gn/T/bundler20151201-657-1v67eg6pg-0.17.1/extensions/universal-darwin-15/2.0.0/pg-0.17.1/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /var/folders/jd/dn7zyf593n97j1rdjbbh_hl00000gn/T/bundler20151201-657-1v67eg6pg-0.17.1/gems/pg-0.17.1 for inspection.
Results logged to /var/folders/jd/dn7zyf593n97j1rdjbbh_hl00000gn/T/bundler20151201-657-1v67eg6pg-0.17.1/extensions/universal-darwin-15/2.0.0/pg-0.17.1/gem_make.out
An error occurred while installing pg (0.17.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.17.1'` succeeds before bundling.
的Gemfile
gem 'rails', '4.2.4'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'bootstrap-sass', '~> 3.2.0'
gem 'autoprefixer-rails'
gem 'pg', '0.17.1'
group :development, :test do
gem 'sqlite3'
gem 'byebug'
gem 'web-console', '~> 2.0'
gem 'spring'
end
group :production do
gem 'rails_12factor', '0.0.2'
gem 'puma', '2.11.1'
end
的database.yml
default: &default
adapter: sqlite3
pool: 5
timeout: 5000
development:
adapter: postgresql
encoding: unicode
database: blog_development
pool: 5
username: ****
password: <!--- this place is **EMPTY** -->
test:
adapter: postgresql
encoding: unicode
database: blog_development
pool: 5
username: ****
password: <!--- this place is **EMPTY** -->
production:
<<: *default
database: db/production.sqlite3
答案 0 :(得分:2)
您必须提供pg_config
的路径。你会找到答案here。
答案 1 :(得分:1)
我猜pg
gem无法找到postgres安装。我想你正在使用Mac,如果是这样的话,试试Postgress.app http://postgresapp.com/,它非常直接。
答案 2 :(得分:0)
这看起来像是
的副本Can't find the 'libpq-fe.h header when trying to install pg gem
其中,顺便说一句,是谷歌搜索的最佳结果“pg gem找不到libpq-fe.h标题”