사용하려고 gem install pg
했지만 작동하지 않는 것 같습니다.
gem install pg
이 오류를 준다
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
C:/Ruby/bin/ruby.exe 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=C:/Ruby/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 C:/Ruby/lib/ruby/gems/1.8/gems/pg-0.10.1 for
inspection.
Results logged to C:/Ruby/lib/ruby/gems/1.8/gems/pg-0.10.1/ext/gem_make.out
답변
여기에 답변 :
Windows에 pg gem을 설치할 수 없습니다
어제 릴리스 된 최신 버전의 pg (0.10.0)의 Windows 기본 버전은 없지만 0.9.0을 설치하면 문제없이 바이너리를 설치해야합니다.
답변
나는이 문제가 있었고, 이것은 나를 위해 일했다 :
postgresql-devel 패키지를 설치하면 pg_config 누락 문제가 해결됩니다.
sudo apt-get install libpq-dev
답변
문제는 gem 의존성이므로 pg를 설치하기 전에 “libpq-dev”를 설치했는지 확인하십시오
우분투 시스템 :
sudo apt-get 설치 libpq-dev
RHEL 시스템 :
yum 설치 postgresql-devel
맥:
brew install postgresql
답변
gem install pg -- --with-pg-config=/usr/pgsql-9.1/bin/pg_config
답변
pg gem은 postgresql 클라이언트 라이브러리 를 바인딩 해야합니다 . 이 오류는 일반적으로 Postgres 라이브러리를 찾을 수 없음을 의미합니다. 설치되어 있지 않거나
--with-pg-dir=
gem 설치 로 전달해야 할 수도 있습니다 .
그것보다, 당신은 --with-pg-config=
그것을 설치해야합니다.
Mac에서
만일 우연히도 맥에있는 웹 사이트 번들을 통해 postgres를 설치했다면, 같은 곳에있을 것 /Applications/Postgres.app/Contents/Versions/9.3/bin
입니다.
따라서 gem 설치에 전달하십시오.
gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config
또는 당신은 제대로 경로를 설정합니다 . PATH를 일시적으로 설정하기에는 너무 많을 수 있습니다.
export PATH=%PATH:/Applications/Postgres.app/Contents/Versions/9.3/bin/
답변
postgresql을 설치하지 않았으므로 방금 사용하여 설치했습니다.
sudo apt-get install postgresql postgresql-server-dev-9.1
우분투 12.04.
이것은 그것을 해결했다.
최신 정보:
최신 버전을 사용하십시오.
sudo apt-get install postgresql-9.3 postgresql-server-dev-9.3
답변
이것은 내 경우에 효과가 있었다.
sudo apt-get install libpq-dev
나는 사용했다 :
- 우분투 14.04.2 LTS
- 루비 2.2.2
- 레일 4.2.1
